1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package kendra
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/kendra/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12	"time"
13)
14
15// Describes an existing Amazon Kendra thesaurus.
16func (c *Client) DescribeThesaurus(ctx context.Context, params *DescribeThesaurusInput, optFns ...func(*Options)) (*DescribeThesaurusOutput, error) {
17	if params == nil {
18		params = &DescribeThesaurusInput{}
19	}
20
21	result, metadata, err := c.invokeOperation(ctx, "DescribeThesaurus", params, optFns, addOperationDescribeThesaurusMiddlewares)
22	if err != nil {
23		return nil, err
24	}
25
26	out := result.(*DescribeThesaurusOutput)
27	out.ResultMetadata = metadata
28	return out, nil
29}
30
31type DescribeThesaurusInput struct {
32
33	// The identifier of the thesaurus to describe.
34	//
35	// This member is required.
36	Id *string
37
38	// The identifier of the index associated with the thesaurus to describe.
39	//
40	// This member is required.
41	IndexId *string
42}
43
44type DescribeThesaurusOutput struct {
45
46	// The Unix datetime that the thesaurus was created.
47	CreatedAt *time.Time
48
49	// The thesaurus description.
50	Description *string
51
52	// When the Status field value is FAILED, the ErrorMessage field provides more
53	// information.
54	ErrorMessage *string
55
56	// The size of the thesaurus file in bytes.
57	FileSizeBytes *int64
58
59	// The identifier of the thesaurus.
60	Id *string
61
62	// The identifier of the index associated with the thesaurus to describe.
63	IndexId *string
64
65	// The thesaurus name.
66	Name *string
67
68	// An AWS Identity and Access Management (IAM) role that gives Amazon Kendra
69	// permissions to access thesaurus file specified in SourceS3Path.
70	RoleArn *string
71
72	// Information required to find a specific file in an Amazon S3 bucket.
73	SourceS3Path *types.S3Path
74
75	// The current status of the thesaurus. When the value is ACTIVE, queries are able
76	// to use the thesaurus. If the Status field value is FAILED, the ErrorMessage
77	// field provides more information. If the status is ACTIVE_BUT_UPDATE_FAILED, it
78	// means that Amazon Kendra could not ingest the new thesaurus file. The old
79	// thesaurus file is still active.
80	Status types.ThesaurusStatus
81
82	// The number of synonym rules in the thesaurus file.
83	SynonymRuleCount *int64
84
85	// The number of unique terms in the thesaurus file. For example, the synonyms
86	// a,b,c and a=>d, the term count would be 4.
87	TermCount *int64
88
89	// The Unix datetime that the thesaurus was last updated.
90	UpdatedAt *time.Time
91
92	// Metadata pertaining to the operation's result.
93	ResultMetadata middleware.Metadata
94}
95
96func addOperationDescribeThesaurusMiddlewares(stack *middleware.Stack, options Options) (err error) {
97	err = stack.Serialize.Add(&awsAwsjson11_serializeOpDescribeThesaurus{}, middleware.After)
98	if err != nil {
99		return err
100	}
101	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDescribeThesaurus{}, middleware.After)
102	if err != nil {
103		return err
104	}
105	if err = addSetLoggerMiddleware(stack, options); err != nil {
106		return err
107	}
108	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
109		return err
110	}
111	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
112		return err
113	}
114	if err = addResolveEndpointMiddleware(stack, options); err != nil {
115		return err
116	}
117	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
118		return err
119	}
120	if err = addRetryMiddlewares(stack, options); err != nil {
121		return err
122	}
123	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
124		return err
125	}
126	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
127		return err
128	}
129	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
130		return err
131	}
132	if err = addClientUserAgent(stack); err != nil {
133		return err
134	}
135	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
136		return err
137	}
138	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
139		return err
140	}
141	if err = addOpDescribeThesaurusValidationMiddleware(stack); err != nil {
142		return err
143	}
144	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeThesaurus(options.Region), middleware.Before); err != nil {
145		return err
146	}
147	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
148		return err
149	}
150	if err = addResponseErrorMiddleware(stack); err != nil {
151		return err
152	}
153	if err = addRequestResponseLogging(stack, options); err != nil {
154		return err
155	}
156	return nil
157}
158
159func newServiceMetadataMiddleware_opDescribeThesaurus(region string) *awsmiddleware.RegisterServiceMetadata {
160	return &awsmiddleware.RegisterServiceMetadata{
161		Region:        region,
162		ServiceID:     ServiceID,
163		SigningName:   "kendra",
164		OperationName: "DescribeThesaurus",
165	}
166}
167