From ab95d973042df88500747914317585e333031218 Mon Sep 17 00:00:00 2001 From: AWS SDK for Go v2 automation user Date: Mon, 15 Aug 2022 18:14:26 +0000 Subject: [PATCH] Regenerated Clients --- .../1046dd96ed084844afd1197e243905c0.json | 8 + .../3cdcbc211b534a909bc296738538ac87.json | 8 + .../605ff411f2134b2b8d2352b16cb94d3e.json | 8 + .../aec86cb0ef8c45389dfb8d80d4fb8960.json | 8 + service/cloudfront/types/enums.go | 8 +- service/cloudfront/types/types.go | 17 +- service/identitystore/doc.go | 9 +- service/sso/doc.go | 2 +- service/wisdom/api_op_PutFeedback.go | 164 +++++++++++++ service/wisdom/deserializers.go | 229 ++++++++++++++++++ service/wisdom/generated.json | 1 + service/wisdom/serializers.go | 105 ++++++++ service/wisdom/types/enums.go | 36 +++ service/wisdom/types/types.go | 11 + service/wisdom/validators.go | 67 +++++ 15 files changed, 671 insertions(+), 10 deletions(-) create mode 100644 .changelog/1046dd96ed084844afd1197e243905c0.json create mode 100644 .changelog/3cdcbc211b534a909bc296738538ac87.json create mode 100644 .changelog/605ff411f2134b2b8d2352b16cb94d3e.json create mode 100644 .changelog/aec86cb0ef8c45389dfb8d80d4fb8960.json create mode 100644 service/wisdom/api_op_PutFeedback.go diff --git a/.changelog/1046dd96ed084844afd1197e243905c0.json b/.changelog/1046dd96ed084844afd1197e243905c0.json new file mode 100644 index 00000000000..021a33d980b --- /dev/null +++ b/.changelog/1046dd96ed084844afd1197e243905c0.json @@ -0,0 +1,8 @@ +{ + "id": "1046dd96-ed08-4844-afd1-197e243905c0", + "type": "documentation", + "description": "Documentation updates to reflect service rename - AWS IAM Identity Center (successor to AWS Single Sign-On)", + "modules": [ + "service/identitystore" + ] +} \ No newline at end of file diff --git a/.changelog/3cdcbc211b534a909bc296738538ac87.json b/.changelog/3cdcbc211b534a909bc296738538ac87.json new file mode 100644 index 00000000000..26b1c417a8a --- /dev/null +++ b/.changelog/3cdcbc211b534a909bc296738538ac87.json @@ -0,0 +1,8 @@ +{ + "id": "3cdcbc21-1b53-4a90-9bc2-96738538ac87", + "type": "documentation", + "description": "Documentation updates to reflect service rename - AWS IAM Identity Center (successor to AWS Single Sign-On)", + "modules": [ + "service/sso" + ] +} \ No newline at end of file diff --git a/.changelog/605ff411f2134b2b8d2352b16cb94d3e.json b/.changelog/605ff411f2134b2b8d2352b16cb94d3e.json new file mode 100644 index 00000000000..a49f1f8d4e8 --- /dev/null +++ b/.changelog/605ff411f2134b2b8d2352b16cb94d3e.json @@ -0,0 +1,8 @@ +{ + "id": "605ff411-f213-4b2b-8d23-52b16cb94d3e", + "type": "feature", + "description": "Adds Http 3 support to distributions", + "modules": [ + "service/cloudfront" + ] +} \ No newline at end of file diff --git a/.changelog/aec86cb0ef8c45389dfb8d80d4fb8960.json b/.changelog/aec86cb0ef8c45389dfb8d80d4fb8960.json new file mode 100644 index 00000000000..e11afd62277 --- /dev/null +++ b/.changelog/aec86cb0ef8c45389dfb8d80d4fb8960.json @@ -0,0 +1,8 @@ +{ + "id": "aec86cb0-ef8c-4538-9dfb-8d80d4fb8960", + "type": "feature", + "description": "This release introduces a new API PutFeedback that allows submitting feedback to Wisdom on content relevance.", + "modules": [ + "service/wisdom" + ] +} \ No newline at end of file diff --git a/service/cloudfront/types/enums.go b/service/cloudfront/types/enums.go index 5a08139a3e8..2a25a13f86b 100644 --- a/service/cloudfront/types/enums.go +++ b/service/cloudfront/types/enums.go @@ -217,8 +217,10 @@ type HttpVersion string // Enum values for HttpVersion const ( - HttpVersionHttp11 HttpVersion = "http1.1" - HttpVersionHttp2 HttpVersion = "http2" + HttpVersionHttp11 HttpVersion = "http1.1" + HttpVersionHttp2 HttpVersion = "http2" + HttpVersionHttp3 HttpVersion = "http3" + HttpVersionHttp2and3 HttpVersion = "http2and3" ) // Values returns all known values for HttpVersion. Note that this can be expanded @@ -228,6 +230,8 @@ func (HttpVersion) Values() []HttpVersion { return []HttpVersion{ "http1.1", "http2", + "http3", + "http2and3", } } diff --git a/service/cloudfront/types/types.go b/service/cloudfront/types/types.go index 3342afc498b..84ffb5596c9 100644 --- a/service/cloudfront/types/types.go +++ b/service/cloudfront/types/types.go @@ -1544,14 +1544,19 @@ type DistributionConfig struct { // in the Amazon CloudFront Developer Guide. DefaultRootObject *string - // (Optional) Specify the maximum HTTP version that you want viewers to use to + // (Optional) Specify the maximum HTTP version(s) that you want viewers to use to // communicate with CloudFront. The default value for new web distributions is // http2. Viewers that don't support HTTP/2 automatically use an earlier HTTP - // version. For viewers and CloudFront to use HTTP/2, viewers must support TLS 1.2 - // or later, and must support Server Name Identification (SNI). In general, - // configuring CloudFront to communicate with viewers using HTTP/2 reduces latency. - // You can improve performance by optimizing for HTTP/2. For more information, do - // an Internet search for "http/2 optimization." + // version. For viewers and CloudFront to use HTTP/2, viewers must support TLSv1.2 + // or later, and must support Server Name Indication (SNI). For viewers and + // CloudFront to use HTTP/3, viewers must support TLSv1.3 and Server Name + // Indication (SNI). CloudFront supports HTTP/3 connection migration to allow the + // viewer to switch networks without losing connection. For more information about + // connection migration, see Connection Migration + // (https://www.rfc-editor.org/rfc/rfc9000.html#name-connection-migration) at RFC + // 9000. For more information about supported TLSv1.3 ciphers, see Supported + // protocols and ciphers between viewers and CloudFront + // (https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/secure-connections-supported-viewer-protocols-ciphers.html). HttpVersion HttpVersion // If you want CloudFront to respond to IPv6 DNS requests with an IPv6 address for diff --git a/service/identitystore/doc.go b/service/identitystore/doc.go index 5ea9d7c50c8..4a40ee0e05a 100644 --- a/service/identitystore/doc.go +++ b/service/identitystore/doc.go @@ -3,8 +3,15 @@ // Package identitystore provides the API client, operations, and parameter types // for AWS SSO Identity Store. // -// The identity store service used by Amazon Web Services Single Sign On provides a +// The Identity Store service used by Amazon Web Services Single Sign On provides a // single place to retrieve all of your identities (users and groups). For more // information, see the Amazon Web Services SSO User Guide // (https://docs.aws.amazon.com/singlesignon/latest/userguide/what-is.html). +// Although Amazon Web Services Single Sign-On was renamed, the sso and +// identitystore API namespaces will continue to retain their original name for +// backward compatibility purposes. For more information, see Amazon Web Services +// SSO rename +// (https://docs.aws.amazon.com/singlesignon/latest/userguide/what-is.html#renamed). +// This reference guide describes the identity store operations that you can call +// programatically and includes detailed information on data types and errors. package identitystore diff --git a/service/sso/doc.go b/service/sso/doc.go index 1c05f14b809..40012670859 100644 --- a/service/sso/doc.go +++ b/service/sso/doc.go @@ -11,7 +11,7 @@ // namespaces will continue to retain their original name for backward // compatibility purposes. For more information, see Amazon Web Services SSO rename // (https://docs.aws.amazon.com/singlesignon/latest/userguide/what-is.html#renamed). -// This API reference guide describes the Amazon Web Services SSO Portal operations +// This reference guide describes the Amazon Web Services SSO Portal operations // that you can call programatically and includes detailed information on data // types and errors. Amazon Web Services provides SDKs that consist of libraries // and sample code for various programming languages and platforms, such as Java, diff --git a/service/wisdom/api_op_PutFeedback.go b/service/wisdom/api_op_PutFeedback.go new file mode 100644 index 00000000000..e71abb0bd03 --- /dev/null +++ b/service/wisdom/api_op_PutFeedback.go @@ -0,0 +1,164 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package wisdom + +import ( + "context" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/wisdom/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Submits feedback to Wisdom. The feedback is used to improve future +// recommendations from GetRecommendations +// (https://docs.aws.amazon.com/wisdom/latest/APIReference/API_GetRecommendations.html) +// or results from QueryAssistant +// (https://docs.aws.amazon.com/wisdom/latest/APIReference/API_QueryAssistant.html). +// Feedback can be resubmitted up to 6 hours after submission. +func (c *Client) PutFeedback(ctx context.Context, params *PutFeedbackInput, optFns ...func(*Options)) (*PutFeedbackOutput, error) { + if params == nil { + params = &PutFeedbackInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "PutFeedback", params, optFns, c.addOperationPutFeedbackMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*PutFeedbackOutput) + out.ResultMetadata = metadata + return out, nil +} + +type PutFeedbackInput struct { + + // The identifier of the Wisdom assistant. Can be either the ID or the ARN. URLs + // cannot contain the ARN. + // + // This member is required. + AssistantId *string + + // The feedback. + // + // This member is required. + Feedback *types.FeedbackData + + // The identifier of a recommendation. or The identifier of the result data. + // + // This member is required. + TargetId *string + + // The type of the targetId for which The feedback. is targeted. + // + // This member is required. + TargetType types.TargetType + + noSmithyDocumentSerde +} + +type PutFeedbackOutput struct { + + // The Amazon Resource Name (ARN) of the Wisdom assistant. + // + // This member is required. + AssistantArn *string + + // The identifier of the Wisdom assistant. + // + // This member is required. + AssistantId *string + + // The feedback. + // + // This member is required. + Feedback *types.FeedbackData + + // The identifier of a recommendation. or The identifier of the result data. + // + // This member is required. + TargetId *string + + // The type of the targetId for which The feedback. is targeted. + // + // This member is required. + TargetType types.TargetType + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationPutFeedbackMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpPutFeedback{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpPutFeedback{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = addHTTPSignerV4Middleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(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 = addOpPutFeedbackValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutFeedback(options.Region), 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 + } + return nil +} + +func newServiceMetadataMiddleware_opPutFeedback(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "wisdom", + OperationName: "PutFeedback", + } +} diff --git a/service/wisdom/deserializers.go b/service/wisdom/deserializers.go index f7ed8ad630d..f091209e95b 100644 --- a/service/wisdom/deserializers.go +++ b/service/wisdom/deserializers.go @@ -3185,6 +3185,195 @@ func awsRestjson1_deserializeOpDocumentNotifyRecommendationsReceivedOutput(v **N return nil } +type awsRestjson1_deserializeOpPutFeedback struct { +} + +func (*awsRestjson1_deserializeOpPutFeedback) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpPutFeedback) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorPutFeedback(response, &metadata) + } + output := &PutFeedbackOutput{} + out.Result = output + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(response.Body, ringBuffer) + + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return out, metadata, err + } + + err = awsRestjson1_deserializeOpDocumentPutFeedbackOutput(&output, shape) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), + Snapshot: snapshot.Bytes(), + } + } + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorPutFeedback(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentPutFeedbackOutput(v **PutFeedbackOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *PutFeedbackOutput + if *v == nil { + sv = &PutFeedbackOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "assistantArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected UuidOrArn to be of type string, got %T instead", value) + } + sv.AssistantArn = ptr.String(jtv) + } + + case "assistantId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.AssistantId = ptr.String(jtv) + } + + case "feedback": + if err := awsRestjson1_deserializeDocumentFeedbackData(&sv.Feedback, value); err != nil { + return err + } + + case "targetId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.TargetId = ptr.String(jtv) + } + + case "targetType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected TargetType to be of type string, got %T instead", value) + } + sv.TargetType = types.TargetType(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + type awsRestjson1_deserializeOpQueryAssistant struct { } @@ -5778,6 +5967,46 @@ func awsRestjson1_deserializeDocumentDocumentText(v **types.DocumentText, value return nil } +func awsRestjson1_deserializeDocumentFeedbackData(v **types.FeedbackData, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.FeedbackData + if *v == nil { + sv = &types.FeedbackData{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "relevance": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Relevance to be of type string, got %T instead", value) + } + sv.Relevance = types.Relevance(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsRestjson1_deserializeDocumentHeaders(v *map[string]string, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) diff --git a/service/wisdom/generated.json b/service/wisdom/generated.json index d35d9dfd982..cd8466f4771 100644 --- a/service/wisdom/generated.json +++ b/service/wisdom/generated.json @@ -30,6 +30,7 @@ "api_op_ListKnowledgeBases.go", "api_op_ListTagsForResource.go", "api_op_NotifyRecommendationsReceived.go", + "api_op_PutFeedback.go", "api_op_QueryAssistant.go", "api_op_RemoveKnowledgeBaseTemplateUri.go", "api_op_SearchContent.go", diff --git a/service/wisdom/serializers.go b/service/wisdom/serializers.go index f61276ba157..6e8a55ed3a4 100644 --- a/service/wisdom/serializers.go +++ b/service/wisdom/serializers.go @@ -1640,6 +1640,99 @@ func awsRestjson1_serializeOpDocumentNotifyRecommendationsReceivedInput(v *Notif return nil } +type awsRestjson1_serializeOpPutFeedback struct { +} + +func (*awsRestjson1_serializeOpPutFeedback) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpPutFeedback) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*PutFeedbackInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/assistants/{assistantId}/feedback") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "PUT" + restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsPutFeedbackInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentPutFeedbackInput(input, jsonEncoder.Value); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = restEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + return next.HandleSerialize(ctx, in) +} +func awsRestjson1_serializeOpHttpBindingsPutFeedbackInput(v *PutFeedbackInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AssistantId == nil || len(*v.AssistantId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member assistantId must not be empty")} + } + if v.AssistantId != nil { + if err := encoder.SetURI("assistantId").String(*v.AssistantId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentPutFeedbackInput(v *PutFeedbackInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Feedback != nil { + ok := object.Key("feedback") + if err := awsRestjson1_serializeDocumentFeedbackData(v.Feedback, ok); err != nil { + return err + } + } + + if v.TargetId != nil { + ok := object.Key("targetId") + ok.String(*v.TargetId) + } + + if len(v.TargetType) > 0 { + ok := object.Key("targetType") + ok.String(string(v.TargetType)) + } + + return nil +} + type awsRestjson1_serializeOpQueryAssistant struct { } @@ -2443,6 +2536,18 @@ func awsRestjson1_serializeDocumentContentMetadata(v map[string]string, value sm return nil } +func awsRestjson1_serializeDocumentFeedbackData(v *types.FeedbackData, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if len(v.Relevance) > 0 { + ok := object.Key("relevance") + ok.String(string(v.Relevance)) + } + + return nil +} + func awsRestjson1_serializeDocumentFilter(v *types.Filter, value smithyjson.Value) error { object := value.Object() defer object.Close() diff --git a/service/wisdom/types/enums.go b/service/wisdom/types/enums.go index 655dc9ac9cd..972f30977c8 100644 --- a/service/wisdom/types/enums.go +++ b/service/wisdom/types/enums.go @@ -216,6 +216,24 @@ func (RecommendationType) Values() []RecommendationType { } } +type Relevance string + +// Enum values for Relevance +const ( + RelevanceHelpful Relevance = "HELPFUL" + RelevanceNotHelpful Relevance = "NOT_HELPFUL" +) + +// Values returns all known values for Relevance. Note that this can be expanded in +// the future, and so it is only as up to date as the client. The ordering of this +// slice is not guaranteed to be stable across updates. +func (Relevance) Values() []Relevance { + return []Relevance{ + "HELPFUL", + "NOT_HELPFUL", + } +} + type RelevanceLevel string // Enum values for RelevanceLevel @@ -235,3 +253,21 @@ func (RelevanceLevel) Values() []RelevanceLevel { "LOW", } } + +type TargetType string + +// Enum values for TargetType +const ( + TargetTypeRecommendation TargetType = "RECOMMENDATION" + TargetTypeResult TargetType = "RESULT" +) + +// Values returns all known values for TargetType. Note that this can be expanded +// in the future, and so it is only as up to date as the client. The ordering of +// this slice is not guaranteed to be stable across updates. +func (TargetType) Values() []TargetType { + return []TargetType{ + "RECOMMENDATION", + "RESULT", + } +} diff --git a/service/wisdom/types/types.go b/service/wisdom/types/types.go index b33ae6cdec2..20ec1d46eb7 100644 --- a/service/wisdom/types/types.go +++ b/service/wisdom/types/types.go @@ -418,6 +418,17 @@ type DocumentText struct { noSmithyDocumentSerde } +// The feedback to submit to Wisdom. +type FeedbackData struct { + + // The relevance of the target this feedback is for. + // + // This member is required. + Relevance Relevance + + noSmithyDocumentSerde +} + // A search filter. type Filter struct { diff --git a/service/wisdom/validators.go b/service/wisdom/validators.go index d8722da2d1c..a95d818fbdb 100644 --- a/service/wisdom/validators.go +++ b/service/wisdom/validators.go @@ -410,6 +410,26 @@ func (m *validateOpNotifyRecommendationsReceived) HandleInitialize(ctx context.C return next.HandleInitialize(ctx, in) } +type validateOpPutFeedback struct { +} + +func (*validateOpPutFeedback) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpPutFeedback) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*PutFeedbackInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpPutFeedbackInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpQueryAssistant struct { } @@ -670,6 +690,10 @@ func addOpNotifyRecommendationsReceivedValidationMiddleware(stack *middleware.St return stack.Initialize.Add(&validateOpNotifyRecommendationsReceived{}, middleware.After) } +func addOpPutFeedbackValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpPutFeedback{}, middleware.After) +} + func addOpQueryAssistantValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpQueryAssistant{}, middleware.After) } @@ -724,6 +748,21 @@ func validateAppIntegrationsConfiguration(v *types.AppIntegrationsConfiguration) } } +func validateFeedbackData(v *types.FeedbackData) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "FeedbackData"} + if len(v.Relevance) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("Relevance")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateFilter(v *types.Filter) error { if v == nil { return nil @@ -1153,6 +1192,34 @@ func validateOpNotifyRecommendationsReceivedInput(v *NotifyRecommendationsReceiv } } +func validateOpPutFeedbackInput(v *PutFeedbackInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "PutFeedbackInput"} + if v.AssistantId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AssistantId")) + } + if v.TargetId == nil { + invalidParams.Add(smithy.NewErrParamRequired("TargetId")) + } + if len(v.TargetType) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("TargetType")) + } + if v.Feedback == nil { + invalidParams.Add(smithy.NewErrParamRequired("Feedback")) + } else if v.Feedback != nil { + if err := validateFeedbackData(v.Feedback); err != nil { + invalidParams.AddNested("Feedback", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpQueryAssistantInput(v *QueryAssistantInput) error { if v == nil { return nil