1// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. 2 3package translate 4 5import ( 6 "time" 7 8 "github.com/aws/aws-sdk-go/aws" 9 "github.com/aws/aws-sdk-go/aws/awsutil" 10 "github.com/aws/aws-sdk-go/aws/request" 11 "github.com/aws/aws-sdk-go/private/protocol" 12 "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" 13) 14 15const opDeleteTerminology = "DeleteTerminology" 16 17// DeleteTerminologyRequest generates a "aws/request.Request" representing the 18// client's request for the DeleteTerminology operation. The "output" return 19// value will be populated with the request's response once the request completes 20// successfully. 21// 22// Use "Send" method on the returned Request to send the API call to the service. 23// the "output" return value is not valid until after Send returns without error. 24// 25// See DeleteTerminology for more information on using the DeleteTerminology 26// API call, and error handling. 27// 28// This method is useful when you want to inject custom logic or configuration 29// into the SDK's request lifecycle. Such as custom headers, or retry logic. 30// 31// 32// // Example sending a request using the DeleteTerminologyRequest method. 33// req, resp := client.DeleteTerminologyRequest(params) 34// 35// err := req.Send() 36// if err == nil { // resp is now filled 37// fmt.Println(resp) 38// } 39// 40// See also, https://docs.aws.amazon.com/goto/WebAPI/translate-2017-07-01/DeleteTerminology 41func (c *Translate) DeleteTerminologyRequest(input *DeleteTerminologyInput) (req *request.Request, output *DeleteTerminologyOutput) { 42 op := &request.Operation{ 43 Name: opDeleteTerminology, 44 HTTPMethod: "POST", 45 HTTPPath: "/", 46 } 47 48 if input == nil { 49 input = &DeleteTerminologyInput{} 50 } 51 52 output = &DeleteTerminologyOutput{} 53 req = c.newRequest(op, input, output) 54 req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) 55 return 56} 57 58// DeleteTerminology API operation for Amazon Translate. 59// 60// A synchronous action that deletes a custom terminology. 61// 62// Returns awserr.Error for service API and SDK errors. Use runtime type assertions 63// with awserr.Error's Code and Message methods to get detailed information about 64// the error. 65// 66// See the AWS API reference guide for Amazon Translate's 67// API operation DeleteTerminology for usage and error information. 68// 69// Returned Error Codes: 70// * ErrCodeResourceNotFoundException "ResourceNotFoundException" 71// The resource you are looking for has not been found. Review the resource 72// you're looking for and see if a different resource will accomplish your needs 73// before retrying the revised request. . 74// 75// * ErrCodeTooManyRequestsException "TooManyRequestsException" 76// You have made too many requests within a short period of time. Wait for a 77// short time and then try your request again. 78// 79// * ErrCodeInternalServerException "InternalServerException" 80// An internal server error occurred. Retry your request. 81// 82// See also, https://docs.aws.amazon.com/goto/WebAPI/translate-2017-07-01/DeleteTerminology 83func (c *Translate) DeleteTerminology(input *DeleteTerminologyInput) (*DeleteTerminologyOutput, error) { 84 req, out := c.DeleteTerminologyRequest(input) 85 return out, req.Send() 86} 87 88// DeleteTerminologyWithContext is the same as DeleteTerminology with the addition of 89// the ability to pass a context and additional request options. 90// 91// See DeleteTerminology for details on how to use this API operation. 92// 93// The context must be non-nil and will be used for request cancellation. If 94// the context is nil a panic will occur. In the future the SDK may create 95// sub-contexts for http.Requests. See https://golang.org/pkg/context/ 96// for more information on using Contexts. 97func (c *Translate) DeleteTerminologyWithContext(ctx aws.Context, input *DeleteTerminologyInput, opts ...request.Option) (*DeleteTerminologyOutput, error) { 98 req, out := c.DeleteTerminologyRequest(input) 99 req.SetContext(ctx) 100 req.ApplyOptions(opts...) 101 return out, req.Send() 102} 103 104const opGetTerminology = "GetTerminology" 105 106// GetTerminologyRequest generates a "aws/request.Request" representing the 107// client's request for the GetTerminology operation. The "output" return 108// value will be populated with the request's response once the request completes 109// successfully. 110// 111// Use "Send" method on the returned Request to send the API call to the service. 112// the "output" return value is not valid until after Send returns without error. 113// 114// See GetTerminology for more information on using the GetTerminology 115// API call, and error handling. 116// 117// This method is useful when you want to inject custom logic or configuration 118// into the SDK's request lifecycle. Such as custom headers, or retry logic. 119// 120// 121// // Example sending a request using the GetTerminologyRequest method. 122// req, resp := client.GetTerminologyRequest(params) 123// 124// err := req.Send() 125// if err == nil { // resp is now filled 126// fmt.Println(resp) 127// } 128// 129// See also, https://docs.aws.amazon.com/goto/WebAPI/translate-2017-07-01/GetTerminology 130func (c *Translate) GetTerminologyRequest(input *GetTerminologyInput) (req *request.Request, output *GetTerminologyOutput) { 131 op := &request.Operation{ 132 Name: opGetTerminology, 133 HTTPMethod: "POST", 134 HTTPPath: "/", 135 } 136 137 if input == nil { 138 input = &GetTerminologyInput{} 139 } 140 141 output = &GetTerminologyOutput{} 142 req = c.newRequest(op, input, output) 143 return 144} 145 146// GetTerminology API operation for Amazon Translate. 147// 148// Retrieves a custom terminology. 149// 150// Returns awserr.Error for service API and SDK errors. Use runtime type assertions 151// with awserr.Error's Code and Message methods to get detailed information about 152// the error. 153// 154// See the AWS API reference guide for Amazon Translate's 155// API operation GetTerminology for usage and error information. 156// 157// Returned Error Codes: 158// * ErrCodeResourceNotFoundException "ResourceNotFoundException" 159// The resource you are looking for has not been found. Review the resource 160// you're looking for and see if a different resource will accomplish your needs 161// before retrying the revised request. . 162// 163// * ErrCodeInvalidParameterValueException "InvalidParameterValueException" 164// The value of the parameter is invalid. Review the value of the parameter 165// you are using to correct it, and then retry your operation. 166// 167// * ErrCodeTooManyRequestsException "TooManyRequestsException" 168// You have made too many requests within a short period of time. Wait for a 169// short time and then try your request again. 170// 171// * ErrCodeInternalServerException "InternalServerException" 172// An internal server error occurred. Retry your request. 173// 174// See also, https://docs.aws.amazon.com/goto/WebAPI/translate-2017-07-01/GetTerminology 175func (c *Translate) GetTerminology(input *GetTerminologyInput) (*GetTerminologyOutput, error) { 176 req, out := c.GetTerminologyRequest(input) 177 return out, req.Send() 178} 179 180// GetTerminologyWithContext is the same as GetTerminology with the addition of 181// the ability to pass a context and additional request options. 182// 183// See GetTerminology for details on how to use this API operation. 184// 185// The context must be non-nil and will be used for request cancellation. If 186// the context is nil a panic will occur. In the future the SDK may create 187// sub-contexts for http.Requests. See https://golang.org/pkg/context/ 188// for more information on using Contexts. 189func (c *Translate) GetTerminologyWithContext(ctx aws.Context, input *GetTerminologyInput, opts ...request.Option) (*GetTerminologyOutput, error) { 190 req, out := c.GetTerminologyRequest(input) 191 req.SetContext(ctx) 192 req.ApplyOptions(opts...) 193 return out, req.Send() 194} 195 196const opImportTerminology = "ImportTerminology" 197 198// ImportTerminologyRequest generates a "aws/request.Request" representing the 199// client's request for the ImportTerminology operation. The "output" return 200// value will be populated with the request's response once the request completes 201// successfully. 202// 203// Use "Send" method on the returned Request to send the API call to the service. 204// the "output" return value is not valid until after Send returns without error. 205// 206// See ImportTerminology for more information on using the ImportTerminology 207// API call, and error handling. 208// 209// This method is useful when you want to inject custom logic or configuration 210// into the SDK's request lifecycle. Such as custom headers, or retry logic. 211// 212// 213// // Example sending a request using the ImportTerminologyRequest method. 214// req, resp := client.ImportTerminologyRequest(params) 215// 216// err := req.Send() 217// if err == nil { // resp is now filled 218// fmt.Println(resp) 219// } 220// 221// See also, https://docs.aws.amazon.com/goto/WebAPI/translate-2017-07-01/ImportTerminology 222func (c *Translate) ImportTerminologyRequest(input *ImportTerminologyInput) (req *request.Request, output *ImportTerminologyOutput) { 223 op := &request.Operation{ 224 Name: opImportTerminology, 225 HTTPMethod: "POST", 226 HTTPPath: "/", 227 } 228 229 if input == nil { 230 input = &ImportTerminologyInput{} 231 } 232 233 output = &ImportTerminologyOutput{} 234 req = c.newRequest(op, input, output) 235 return 236} 237 238// ImportTerminology API operation for Amazon Translate. 239// 240// Creates or updates a custom terminology, depending on whether or not one 241// already exists for the given terminology name. Importing a terminology with 242// the same name as an existing one will merge the terminologies based on the 243// chosen merge strategy. Currently, the only supported merge strategy is OVERWRITE, 244// and so the imported terminology will overwrite an existing terminology of 245// the same name. 246// 247// If you import a terminology that overwrites an existing one, the new terminology 248// take up to 10 minutes to fully propagate and be available for use in a translation 249// due to cache policies with the DataPlane service that performs the translations. 250// 251// Returns awserr.Error for service API and SDK errors. Use runtime type assertions 252// with awserr.Error's Code and Message methods to get detailed information about 253// the error. 254// 255// See the AWS API reference guide for Amazon Translate's 256// API operation ImportTerminology for usage and error information. 257// 258// Returned Error Codes: 259// * ErrCodeInvalidParameterValueException "InvalidParameterValueException" 260// The value of the parameter is invalid. Review the value of the parameter 261// you are using to correct it, and then retry your operation. 262// 263// * ErrCodeLimitExceededException "LimitExceededException" 264// The specified limit has been exceeded. Review your request and retry it with 265// a quantity below the stated limit. 266// 267// * ErrCodeTooManyRequestsException "TooManyRequestsException" 268// You have made too many requests within a short period of time. Wait for a 269// short time and then try your request again. 270// 271// * ErrCodeInternalServerException "InternalServerException" 272// An internal server error occurred. Retry your request. 273// 274// See also, https://docs.aws.amazon.com/goto/WebAPI/translate-2017-07-01/ImportTerminology 275func (c *Translate) ImportTerminology(input *ImportTerminologyInput) (*ImportTerminologyOutput, error) { 276 req, out := c.ImportTerminologyRequest(input) 277 return out, req.Send() 278} 279 280// ImportTerminologyWithContext is the same as ImportTerminology with the addition of 281// the ability to pass a context and additional request options. 282// 283// See ImportTerminology for details on how to use this API operation. 284// 285// The context must be non-nil and will be used for request cancellation. If 286// the context is nil a panic will occur. In the future the SDK may create 287// sub-contexts for http.Requests. See https://golang.org/pkg/context/ 288// for more information on using Contexts. 289func (c *Translate) ImportTerminologyWithContext(ctx aws.Context, input *ImportTerminologyInput, opts ...request.Option) (*ImportTerminologyOutput, error) { 290 req, out := c.ImportTerminologyRequest(input) 291 req.SetContext(ctx) 292 req.ApplyOptions(opts...) 293 return out, req.Send() 294} 295 296const opListTerminologies = "ListTerminologies" 297 298// ListTerminologiesRequest generates a "aws/request.Request" representing the 299// client's request for the ListTerminologies operation. The "output" return 300// value will be populated with the request's response once the request completes 301// successfully. 302// 303// Use "Send" method on the returned Request to send the API call to the service. 304// the "output" return value is not valid until after Send returns without error. 305// 306// See ListTerminologies for more information on using the ListTerminologies 307// API call, and error handling. 308// 309// This method is useful when you want to inject custom logic or configuration 310// into the SDK's request lifecycle. Such as custom headers, or retry logic. 311// 312// 313// // Example sending a request using the ListTerminologiesRequest method. 314// req, resp := client.ListTerminologiesRequest(params) 315// 316// err := req.Send() 317// if err == nil { // resp is now filled 318// fmt.Println(resp) 319// } 320// 321// See also, https://docs.aws.amazon.com/goto/WebAPI/translate-2017-07-01/ListTerminologies 322func (c *Translate) ListTerminologiesRequest(input *ListTerminologiesInput) (req *request.Request, output *ListTerminologiesOutput) { 323 op := &request.Operation{ 324 Name: opListTerminologies, 325 HTTPMethod: "POST", 326 HTTPPath: "/", 327 } 328 329 if input == nil { 330 input = &ListTerminologiesInput{} 331 } 332 333 output = &ListTerminologiesOutput{} 334 req = c.newRequest(op, input, output) 335 return 336} 337 338// ListTerminologies API operation for Amazon Translate. 339// 340// Provides a list of custom terminologies associated with your account. 341// 342// Returns awserr.Error for service API and SDK errors. Use runtime type assertions 343// with awserr.Error's Code and Message methods to get detailed information about 344// the error. 345// 346// See the AWS API reference guide for Amazon Translate's 347// API operation ListTerminologies for usage and error information. 348// 349// Returned Error Codes: 350// * ErrCodeInvalidParameterValueException "InvalidParameterValueException" 351// The value of the parameter is invalid. Review the value of the parameter 352// you are using to correct it, and then retry your operation. 353// 354// * ErrCodeTooManyRequestsException "TooManyRequestsException" 355// You have made too many requests within a short period of time. Wait for a 356// short time and then try your request again. 357// 358// * ErrCodeInternalServerException "InternalServerException" 359// An internal server error occurred. Retry your request. 360// 361// See also, https://docs.aws.amazon.com/goto/WebAPI/translate-2017-07-01/ListTerminologies 362func (c *Translate) ListTerminologies(input *ListTerminologiesInput) (*ListTerminologiesOutput, error) { 363 req, out := c.ListTerminologiesRequest(input) 364 return out, req.Send() 365} 366 367// ListTerminologiesWithContext is the same as ListTerminologies with the addition of 368// the ability to pass a context and additional request options. 369// 370// See ListTerminologies for details on how to use this API operation. 371// 372// The context must be non-nil and will be used for request cancellation. If 373// the context is nil a panic will occur. In the future the SDK may create 374// sub-contexts for http.Requests. See https://golang.org/pkg/context/ 375// for more information on using Contexts. 376func (c *Translate) ListTerminologiesWithContext(ctx aws.Context, input *ListTerminologiesInput, opts ...request.Option) (*ListTerminologiesOutput, error) { 377 req, out := c.ListTerminologiesRequest(input) 378 req.SetContext(ctx) 379 req.ApplyOptions(opts...) 380 return out, req.Send() 381} 382 383const opText = "TranslateText" 384 385// TextRequest generates a "aws/request.Request" representing the 386// client's request for the Text operation. The "output" return 387// value will be populated with the request's response once the request completes 388// successfully. 389// 390// Use "Send" method on the returned Request to send the API call to the service. 391// the "output" return value is not valid until after Send returns without error. 392// 393// See Text for more information on using the Text 394// API call, and error handling. 395// 396// This method is useful when you want to inject custom logic or configuration 397// into the SDK's request lifecycle. Such as custom headers, or retry logic. 398// 399// 400// // Example sending a request using the TextRequest method. 401// req, resp := client.TextRequest(params) 402// 403// err := req.Send() 404// if err == nil { // resp is now filled 405// fmt.Println(resp) 406// } 407// 408// See also, https://docs.aws.amazon.com/goto/WebAPI/translate-2017-07-01/Text 409func (c *Translate) TextRequest(input *TextInput) (req *request.Request, output *TextOutput) { 410 op := &request.Operation{ 411 Name: opText, 412 HTTPMethod: "POST", 413 HTTPPath: "/", 414 } 415 416 if input == nil { 417 input = &TextInput{} 418 } 419 420 output = &TextOutput{} 421 req = c.newRequest(op, input, output) 422 return 423} 424 425// Text API operation for Amazon Translate. 426// 427// Translates input text from the source language to the target language. It 428// is not necessary to use English (en) as either the source or the target language 429// but not all language combinations are supported by Amazon Translate. For 430// more information, see Supported Language Pairs (http://docs.aws.amazon.com/translate/latest/dg/pairs.html). 431// 432// * Arabic (ar) 433// 434// * Chinese (Simplified) (zh) 435// 436// * Chinese (Traditional) (zh-TW) 437// 438// * Czech (cs) 439// 440// * Danish (da) 441// 442// * Dutch (nl) 443// 444// * English (en) 445// 446// * Finnish (fi) 447// 448// * French (fr) 449// 450// * German (de) 451// 452// * Hebrew (he) 453// 454// * Indonesian (id) 455// 456// * Italian (it) 457// 458// * Japanese (ja) 459// 460// * Korean (ko) 461// 462// * Polish (pl) 463// 464// * Portuguese (pt) 465// 466// * Russian (ru) 467// 468// * Spanish (es) 469// 470// * Swedish (sv) 471// 472// * Turkish (tr) 473// 474// To have Amazon Translate determine the source language of your text, you 475// can specify auto in the SourceLanguageCode field. If you specify auto, Amazon 476// Translate will call Amazon Comprehend to determine the source language. 477// 478// Returns awserr.Error for service API and SDK errors. Use runtime type assertions 479// with awserr.Error's Code and Message methods to get detailed information about 480// the error. 481// 482// See the AWS API reference guide for Amazon Translate's 483// API operation Text for usage and error information. 484// 485// Returned Error Codes: 486// * ErrCodeInvalidRequestException "InvalidRequestException" 487// The request that you made is invalid. Check your request to determine why 488// it's invalid and then retry the request. 489// 490// * ErrCodeTextSizeLimitExceededException "TextSizeLimitExceededException" 491// The size of the text you submitted exceeds the size limit. Reduce the size 492// of the text or use a smaller document and then retry your request. 493// 494// * ErrCodeTooManyRequestsException "TooManyRequestsException" 495// You have made too many requests within a short period of time. Wait for a 496// short time and then try your request again. 497// 498// * ErrCodeUnsupportedLanguagePairException "UnsupportedLanguagePairException" 499// Amazon Translate does not support translation from the language of the source 500// text into the requested target language. For more information, see how-to-error-msg. 501// 502// * ErrCodeDetectedLanguageLowConfidenceException "DetectedLanguageLowConfidenceException" 503// The confidence that Amazon Comprehend accurately detected the source language 504// is low. If a low confidence level is acceptable for your application, you 505// can use the language in the exception to call Amazon Translate again. For 506// more information, see the DetectDominantLanguage (https://docs.aws.amazon.com/comprehend/latest/dg/API_DetectDominantLanguage.html) 507// operation in the Amazon Comprehend Developer Guide. 508// 509// * ErrCodeResourceNotFoundException "ResourceNotFoundException" 510// The resource you are looking for has not been found. Review the resource 511// you're looking for and see if a different resource will accomplish your needs 512// before retrying the revised request. . 513// 514// * ErrCodeInternalServerException "InternalServerException" 515// An internal server error occurred. Retry your request. 516// 517// * ErrCodeServiceUnavailableException "ServiceUnavailableException" 518// The Amazon Translate service is temporarily unavailable. Please wait a bit 519// and then retry your request. 520// 521// See also, https://docs.aws.amazon.com/goto/WebAPI/translate-2017-07-01/Text 522func (c *Translate) Text(input *TextInput) (*TextOutput, error) { 523 req, out := c.TextRequest(input) 524 return out, req.Send() 525} 526 527// TextWithContext is the same as Text with the addition of 528// the ability to pass a context and additional request options. 529// 530// See Text for details on how to use this API operation. 531// 532// The context must be non-nil and will be used for request cancellation. If 533// the context is nil a panic will occur. In the future the SDK may create 534// sub-contexts for http.Requests. See https://golang.org/pkg/context/ 535// for more information on using Contexts. 536func (c *Translate) TextWithContext(ctx aws.Context, input *TextInput, opts ...request.Option) (*TextOutput, error) { 537 req, out := c.TextRequest(input) 538 req.SetContext(ctx) 539 req.ApplyOptions(opts...) 540 return out, req.Send() 541} 542 543// The custom terminology applied to the input text by Amazon Translate for 544// the translated text response. This is optional in the response and will only 545// be present if you specified terminology input in the request. Currently, 546// only one terminology can be applied per TranslateText request. 547type AppliedTerminology struct { 548 _ struct{} `type:"structure"` 549 550 // The name of the custom terminology applied to the input text by Amazon Translate 551 // for the translated text response. 552 Name *string `min:"1" type:"string"` 553 554 // The specific terms of the custom terminology applied to the input text by 555 // Amazon Translate for the translated text response. A maximum of 250 terms 556 // will be returned, and the specific terms applied will be the first 250 terms 557 // in the source text. 558 Terms []*Term `type:"list"` 559} 560 561// String returns the string representation 562func (s AppliedTerminology) String() string { 563 return awsutil.Prettify(s) 564} 565 566// GoString returns the string representation 567func (s AppliedTerminology) GoString() string { 568 return s.String() 569} 570 571// SetName sets the Name field's value. 572func (s *AppliedTerminology) SetName(v string) *AppliedTerminology { 573 s.Name = &v 574 return s 575} 576 577// SetTerms sets the Terms field's value. 578func (s *AppliedTerminology) SetTerms(v []*Term) *AppliedTerminology { 579 s.Terms = v 580 return s 581} 582 583type DeleteTerminologyInput struct { 584 _ struct{} `type:"structure"` 585 586 // The name of the custom terminology being deleted. 587 // 588 // Name is a required field 589 Name *string `min:"1" type:"string" required:"true"` 590} 591 592// String returns the string representation 593func (s DeleteTerminologyInput) String() string { 594 return awsutil.Prettify(s) 595} 596 597// GoString returns the string representation 598func (s DeleteTerminologyInput) GoString() string { 599 return s.String() 600} 601 602// Validate inspects the fields of the type to determine if they are valid. 603func (s *DeleteTerminologyInput) Validate() error { 604 invalidParams := request.ErrInvalidParams{Context: "DeleteTerminologyInput"} 605 if s.Name == nil { 606 invalidParams.Add(request.NewErrParamRequired("Name")) 607 } 608 if s.Name != nil && len(*s.Name) < 1 { 609 invalidParams.Add(request.NewErrParamMinLen("Name", 1)) 610 } 611 612 if invalidParams.Len() > 0 { 613 return invalidParams 614 } 615 return nil 616} 617 618// SetName sets the Name field's value. 619func (s *DeleteTerminologyInput) SetName(v string) *DeleteTerminologyInput { 620 s.Name = &v 621 return s 622} 623 624type DeleteTerminologyOutput struct { 625 _ struct{} `type:"structure"` 626} 627 628// String returns the string representation 629func (s DeleteTerminologyOutput) String() string { 630 return awsutil.Prettify(s) 631} 632 633// GoString returns the string representation 634func (s DeleteTerminologyOutput) GoString() string { 635 return s.String() 636} 637 638// The encryption key used to encrypt the custom terminologies used by Amazon 639// Translate. 640type EncryptionKey struct { 641 _ struct{} `type:"structure"` 642 643 // The Amazon Resource Name (ARN) of the encryption key being used to encrypt 644 // the custom terminology. 645 // 646 // Id is a required field 647 Id *string `min:"1" type:"string" required:"true"` 648 649 // The type of encryption key used by Amazon Translate to encrypt custom terminologies. 650 // 651 // Type is a required field 652 Type *string `type:"string" required:"true" enum:"EncryptionKeyType"` 653} 654 655// String returns the string representation 656func (s EncryptionKey) String() string { 657 return awsutil.Prettify(s) 658} 659 660// GoString returns the string representation 661func (s EncryptionKey) GoString() string { 662 return s.String() 663} 664 665// Validate inspects the fields of the type to determine if they are valid. 666func (s *EncryptionKey) Validate() error { 667 invalidParams := request.ErrInvalidParams{Context: "EncryptionKey"} 668 if s.Id == nil { 669 invalidParams.Add(request.NewErrParamRequired("Id")) 670 } 671 if s.Id != nil && len(*s.Id) < 1 { 672 invalidParams.Add(request.NewErrParamMinLen("Id", 1)) 673 } 674 if s.Type == nil { 675 invalidParams.Add(request.NewErrParamRequired("Type")) 676 } 677 678 if invalidParams.Len() > 0 { 679 return invalidParams 680 } 681 return nil 682} 683 684// SetId sets the Id field's value. 685func (s *EncryptionKey) SetId(v string) *EncryptionKey { 686 s.Id = &v 687 return s 688} 689 690// SetType sets the Type field's value. 691func (s *EncryptionKey) SetType(v string) *EncryptionKey { 692 s.Type = &v 693 return s 694} 695 696type GetTerminologyInput struct { 697 _ struct{} `type:"structure"` 698 699 // The name of the custom terminology being retrieved. 700 // 701 // Name is a required field 702 Name *string `min:"1" type:"string" required:"true"` 703 704 // The data format of the custom terminology being retrieved, either CSV or 705 // TMX. 706 // 707 // TerminologyDataFormat is a required field 708 TerminologyDataFormat *string `type:"string" required:"true" enum:"TerminologyDataFormat"` 709} 710 711// String returns the string representation 712func (s GetTerminologyInput) String() string { 713 return awsutil.Prettify(s) 714} 715 716// GoString returns the string representation 717func (s GetTerminologyInput) GoString() string { 718 return s.String() 719} 720 721// Validate inspects the fields of the type to determine if they are valid. 722func (s *GetTerminologyInput) Validate() error { 723 invalidParams := request.ErrInvalidParams{Context: "GetTerminologyInput"} 724 if s.Name == nil { 725 invalidParams.Add(request.NewErrParamRequired("Name")) 726 } 727 if s.Name != nil && len(*s.Name) < 1 { 728 invalidParams.Add(request.NewErrParamMinLen("Name", 1)) 729 } 730 if s.TerminologyDataFormat == nil { 731 invalidParams.Add(request.NewErrParamRequired("TerminologyDataFormat")) 732 } 733 734 if invalidParams.Len() > 0 { 735 return invalidParams 736 } 737 return nil 738} 739 740// SetName sets the Name field's value. 741func (s *GetTerminologyInput) SetName(v string) *GetTerminologyInput { 742 s.Name = &v 743 return s 744} 745 746// SetTerminologyDataFormat sets the TerminologyDataFormat field's value. 747func (s *GetTerminologyInput) SetTerminologyDataFormat(v string) *GetTerminologyInput { 748 s.TerminologyDataFormat = &v 749 return s 750} 751 752type GetTerminologyOutput struct { 753 _ struct{} `type:"structure"` 754 755 // The data location of the custom terminology being retrieved. The custom terminology 756 // file is returned in a presigned url that has a 30 minute expiration. 757 TerminologyDataLocation *TerminologyDataLocation `type:"structure"` 758 759 // The properties of the custom terminology being retrieved. 760 TerminologyProperties *TerminologyProperties `type:"structure"` 761} 762 763// String returns the string representation 764func (s GetTerminologyOutput) String() string { 765 return awsutil.Prettify(s) 766} 767 768// GoString returns the string representation 769func (s GetTerminologyOutput) GoString() string { 770 return s.String() 771} 772 773// SetTerminologyDataLocation sets the TerminologyDataLocation field's value. 774func (s *GetTerminologyOutput) SetTerminologyDataLocation(v *TerminologyDataLocation) *GetTerminologyOutput { 775 s.TerminologyDataLocation = v 776 return s 777} 778 779// SetTerminologyProperties sets the TerminologyProperties field's value. 780func (s *GetTerminologyOutput) SetTerminologyProperties(v *TerminologyProperties) *GetTerminologyOutput { 781 s.TerminologyProperties = v 782 return s 783} 784 785type ImportTerminologyInput struct { 786 _ struct{} `type:"structure"` 787 788 // The description of the custom terminology being imported. 789 Description *string `type:"string"` 790 791 // The encryption key for the custom terminology being imported. 792 EncryptionKey *EncryptionKey `type:"structure"` 793 794 // The merge strategy of the custom terminology being imported. Currently, only 795 // the OVERWRITE merge strategy is supported. In this case, the imported terminology 796 // will overwrite an existing terminology of the same name. 797 // 798 // MergeStrategy is a required field 799 MergeStrategy *string `type:"string" required:"true" enum:"MergeStrategy"` 800 801 // The name of the custom terminology being imported. 802 // 803 // Name is a required field 804 Name *string `min:"1" type:"string" required:"true"` 805 806 // The terminology data for the custom terminology being imported. 807 // 808 // TerminologyData is a required field 809 TerminologyData *TerminologyData `type:"structure" required:"true"` 810} 811 812// String returns the string representation 813func (s ImportTerminologyInput) String() string { 814 return awsutil.Prettify(s) 815} 816 817// GoString returns the string representation 818func (s ImportTerminologyInput) GoString() string { 819 return s.String() 820} 821 822// Validate inspects the fields of the type to determine if they are valid. 823func (s *ImportTerminologyInput) Validate() error { 824 invalidParams := request.ErrInvalidParams{Context: "ImportTerminologyInput"} 825 if s.MergeStrategy == nil { 826 invalidParams.Add(request.NewErrParamRequired("MergeStrategy")) 827 } 828 if s.Name == nil { 829 invalidParams.Add(request.NewErrParamRequired("Name")) 830 } 831 if s.Name != nil && len(*s.Name) < 1 { 832 invalidParams.Add(request.NewErrParamMinLen("Name", 1)) 833 } 834 if s.TerminologyData == nil { 835 invalidParams.Add(request.NewErrParamRequired("TerminologyData")) 836 } 837 if s.EncryptionKey != nil { 838 if err := s.EncryptionKey.Validate(); err != nil { 839 invalidParams.AddNested("EncryptionKey", err.(request.ErrInvalidParams)) 840 } 841 } 842 if s.TerminologyData != nil { 843 if err := s.TerminologyData.Validate(); err != nil { 844 invalidParams.AddNested("TerminologyData", err.(request.ErrInvalidParams)) 845 } 846 } 847 848 if invalidParams.Len() > 0 { 849 return invalidParams 850 } 851 return nil 852} 853 854// SetDescription sets the Description field's value. 855func (s *ImportTerminologyInput) SetDescription(v string) *ImportTerminologyInput { 856 s.Description = &v 857 return s 858} 859 860// SetEncryptionKey sets the EncryptionKey field's value. 861func (s *ImportTerminologyInput) SetEncryptionKey(v *EncryptionKey) *ImportTerminologyInput { 862 s.EncryptionKey = v 863 return s 864} 865 866// SetMergeStrategy sets the MergeStrategy field's value. 867func (s *ImportTerminologyInput) SetMergeStrategy(v string) *ImportTerminologyInput { 868 s.MergeStrategy = &v 869 return s 870} 871 872// SetName sets the Name field's value. 873func (s *ImportTerminologyInput) SetName(v string) *ImportTerminologyInput { 874 s.Name = &v 875 return s 876} 877 878// SetTerminologyData sets the TerminologyData field's value. 879func (s *ImportTerminologyInput) SetTerminologyData(v *TerminologyData) *ImportTerminologyInput { 880 s.TerminologyData = v 881 return s 882} 883 884type ImportTerminologyOutput struct { 885 _ struct{} `type:"structure"` 886 887 // The properties of the custom terminology being imported. 888 TerminologyProperties *TerminologyProperties `type:"structure"` 889} 890 891// String returns the string representation 892func (s ImportTerminologyOutput) String() string { 893 return awsutil.Prettify(s) 894} 895 896// GoString returns the string representation 897func (s ImportTerminologyOutput) GoString() string { 898 return s.String() 899} 900 901// SetTerminologyProperties sets the TerminologyProperties field's value. 902func (s *ImportTerminologyOutput) SetTerminologyProperties(v *TerminologyProperties) *ImportTerminologyOutput { 903 s.TerminologyProperties = v 904 return s 905} 906 907type ListTerminologiesInput struct { 908 _ struct{} `type:"structure"` 909 910 // The maximum number of custom terminologies returned per list request. 911 MaxResults *int64 `min:"1" type:"integer"` 912 913 // If the result of the request to ListTerminologies was truncated, include 914 // the NextToken to fetch the next group of custom terminologies. 915 NextToken *string `type:"string"` 916} 917 918// String returns the string representation 919func (s ListTerminologiesInput) String() string { 920 return awsutil.Prettify(s) 921} 922 923// GoString returns the string representation 924func (s ListTerminologiesInput) GoString() string { 925 return s.String() 926} 927 928// Validate inspects the fields of the type to determine if they are valid. 929func (s *ListTerminologiesInput) Validate() error { 930 invalidParams := request.ErrInvalidParams{Context: "ListTerminologiesInput"} 931 if s.MaxResults != nil && *s.MaxResults < 1 { 932 invalidParams.Add(request.NewErrParamMinValue("MaxResults", 1)) 933 } 934 935 if invalidParams.Len() > 0 { 936 return invalidParams 937 } 938 return nil 939} 940 941// SetMaxResults sets the MaxResults field's value. 942func (s *ListTerminologiesInput) SetMaxResults(v int64) *ListTerminologiesInput { 943 s.MaxResults = &v 944 return s 945} 946 947// SetNextToken sets the NextToken field's value. 948func (s *ListTerminologiesInput) SetNextToken(v string) *ListTerminologiesInput { 949 s.NextToken = &v 950 return s 951} 952 953type ListTerminologiesOutput struct { 954 _ struct{} `type:"structure"` 955 956 // If the response to the ListTerminologies was truncated, the NextToken fetches 957 // the next group of custom terminologies. 958 NextToken *string `type:"string"` 959 960 // The properties list of the custom terminologies returned on the list request. 961 TerminologyPropertiesList []*TerminologyProperties `type:"list"` 962} 963 964// String returns the string representation 965func (s ListTerminologiesOutput) String() string { 966 return awsutil.Prettify(s) 967} 968 969// GoString returns the string representation 970func (s ListTerminologiesOutput) GoString() string { 971 return s.String() 972} 973 974// SetNextToken sets the NextToken field's value. 975func (s *ListTerminologiesOutput) SetNextToken(v string) *ListTerminologiesOutput { 976 s.NextToken = &v 977 return s 978} 979 980// SetTerminologyPropertiesList sets the TerminologyPropertiesList field's value. 981func (s *ListTerminologiesOutput) SetTerminologyPropertiesList(v []*TerminologyProperties) *ListTerminologiesOutput { 982 s.TerminologyPropertiesList = v 983 return s 984} 985 986// The term being translated by the custom terminology. 987type Term struct { 988 _ struct{} `type:"structure"` 989 990 // The source text of the term being translated by the custom terminology. 991 SourceText *string `type:"string"` 992 993 // The target text of the term being translated by the custom terminology. 994 TargetText *string `type:"string"` 995} 996 997// String returns the string representation 998func (s Term) String() string { 999 return awsutil.Prettify(s) 1000} 1001 1002// GoString returns the string representation 1003func (s Term) GoString() string { 1004 return s.String() 1005} 1006 1007// SetSourceText sets the SourceText field's value. 1008func (s *Term) SetSourceText(v string) *Term { 1009 s.SourceText = &v 1010 return s 1011} 1012 1013// SetTargetText sets the TargetText field's value. 1014func (s *Term) SetTargetText(v string) *Term { 1015 s.TargetText = &v 1016 return s 1017} 1018 1019// The data associated with the custom terminology. 1020type TerminologyData struct { 1021 _ struct{} `type:"structure"` 1022 1023 // The file containing the custom terminology data. 1024 // 1025 // File is automatically base64 encoded/decoded by the SDK. 1026 // 1027 // File is a required field 1028 File []byte `type:"blob" required:"true" sensitive:"true"` 1029 1030 // The data format of the custom terminology. Either CSV or TMX. 1031 // 1032 // Format is a required field 1033 Format *string `type:"string" required:"true" enum:"TerminologyDataFormat"` 1034} 1035 1036// String returns the string representation 1037func (s TerminologyData) String() string { 1038 return awsutil.Prettify(s) 1039} 1040 1041// GoString returns the string representation 1042func (s TerminologyData) GoString() string { 1043 return s.String() 1044} 1045 1046// Validate inspects the fields of the type to determine if they are valid. 1047func (s *TerminologyData) Validate() error { 1048 invalidParams := request.ErrInvalidParams{Context: "TerminologyData"} 1049 if s.File == nil { 1050 invalidParams.Add(request.NewErrParamRequired("File")) 1051 } 1052 if s.Format == nil { 1053 invalidParams.Add(request.NewErrParamRequired("Format")) 1054 } 1055 1056 if invalidParams.Len() > 0 { 1057 return invalidParams 1058 } 1059 return nil 1060} 1061 1062// SetFile sets the File field's value. 1063func (s *TerminologyData) SetFile(v []byte) *TerminologyData { 1064 s.File = v 1065 return s 1066} 1067 1068// SetFormat sets the Format field's value. 1069func (s *TerminologyData) SetFormat(v string) *TerminologyData { 1070 s.Format = &v 1071 return s 1072} 1073 1074// The location of the custom terminology data. 1075type TerminologyDataLocation struct { 1076 _ struct{} `type:"structure"` 1077 1078 // The location of the custom terminology data. 1079 // 1080 // Location is a required field 1081 Location *string `type:"string" required:"true"` 1082 1083 // The repository type for the custom terminology data. 1084 // 1085 // RepositoryType is a required field 1086 RepositoryType *string `type:"string" required:"true"` 1087} 1088 1089// String returns the string representation 1090func (s TerminologyDataLocation) String() string { 1091 return awsutil.Prettify(s) 1092} 1093 1094// GoString returns the string representation 1095func (s TerminologyDataLocation) GoString() string { 1096 return s.String() 1097} 1098 1099// SetLocation sets the Location field's value. 1100func (s *TerminologyDataLocation) SetLocation(v string) *TerminologyDataLocation { 1101 s.Location = &v 1102 return s 1103} 1104 1105// SetRepositoryType sets the RepositoryType field's value. 1106func (s *TerminologyDataLocation) SetRepositoryType(v string) *TerminologyDataLocation { 1107 s.RepositoryType = &v 1108 return s 1109} 1110 1111// The properties of the custom terminology. 1112type TerminologyProperties struct { 1113 _ struct{} `type:"structure"` 1114 1115 // The Amazon Resource Name (ARN) of the custom terminology. 1116 Arn *string `type:"string"` 1117 1118 // The time at which the custom terminology was created, based on the timestamp. 1119 CreatedAt *time.Time `type:"timestamp"` 1120 1121 // The description of the custom terminology properties. 1122 Description *string `type:"string"` 1123 1124 // The encryption key for the custom terminology. 1125 EncryptionKey *EncryptionKey `type:"structure"` 1126 1127 // The time at which the custom terminology was last update, based on the timestamp. 1128 LastUpdatedAt *time.Time `type:"timestamp"` 1129 1130 // The name of the custom terminology. 1131 Name *string `min:"1" type:"string"` 1132 1133 // The size of the file used when importing a custom terminology. 1134 SizeBytes *int64 `type:"integer"` 1135 1136 // The language code for the source text of the translation request for which 1137 // the custom terminology is being used. 1138 SourceLanguageCode *string `min:"2" type:"string"` 1139 1140 // The language codes for the target languages available with the custom terminology 1141 // file. All possible target languages are returned in array. 1142 TargetLanguageCodes []*string `type:"list"` 1143 1144 // The number of terms included in the custom terminology. 1145 TermCount *int64 `type:"integer"` 1146} 1147 1148// String returns the string representation 1149func (s TerminologyProperties) String() string { 1150 return awsutil.Prettify(s) 1151} 1152 1153// GoString returns the string representation 1154func (s TerminologyProperties) GoString() string { 1155 return s.String() 1156} 1157 1158// SetArn sets the Arn field's value. 1159func (s *TerminologyProperties) SetArn(v string) *TerminologyProperties { 1160 s.Arn = &v 1161 return s 1162} 1163 1164// SetCreatedAt sets the CreatedAt field's value. 1165func (s *TerminologyProperties) SetCreatedAt(v time.Time) *TerminologyProperties { 1166 s.CreatedAt = &v 1167 return s 1168} 1169 1170// SetDescription sets the Description field's value. 1171func (s *TerminologyProperties) SetDescription(v string) *TerminologyProperties { 1172 s.Description = &v 1173 return s 1174} 1175 1176// SetEncryptionKey sets the EncryptionKey field's value. 1177func (s *TerminologyProperties) SetEncryptionKey(v *EncryptionKey) *TerminologyProperties { 1178 s.EncryptionKey = v 1179 return s 1180} 1181 1182// SetLastUpdatedAt sets the LastUpdatedAt field's value. 1183func (s *TerminologyProperties) SetLastUpdatedAt(v time.Time) *TerminologyProperties { 1184 s.LastUpdatedAt = &v 1185 return s 1186} 1187 1188// SetName sets the Name field's value. 1189func (s *TerminologyProperties) SetName(v string) *TerminologyProperties { 1190 s.Name = &v 1191 return s 1192} 1193 1194// SetSizeBytes sets the SizeBytes field's value. 1195func (s *TerminologyProperties) SetSizeBytes(v int64) *TerminologyProperties { 1196 s.SizeBytes = &v 1197 return s 1198} 1199 1200// SetSourceLanguageCode sets the SourceLanguageCode field's value. 1201func (s *TerminologyProperties) SetSourceLanguageCode(v string) *TerminologyProperties { 1202 s.SourceLanguageCode = &v 1203 return s 1204} 1205 1206// SetTargetLanguageCodes sets the TargetLanguageCodes field's value. 1207func (s *TerminologyProperties) SetTargetLanguageCodes(v []*string) *TerminologyProperties { 1208 s.TargetLanguageCodes = v 1209 return s 1210} 1211 1212// SetTermCount sets the TermCount field's value. 1213func (s *TerminologyProperties) SetTermCount(v int64) *TerminologyProperties { 1214 s.TermCount = &v 1215 return s 1216} 1217 1218type TextInput struct { 1219 _ struct{} `type:"structure"` 1220 1221 // The language code for the language of the source text. The language must 1222 // be a language supported by Amazon Translate. 1223 // 1224 // To have Amazon Translate determine the source language of your text, you 1225 // can specify auto in the SourceLanguageCode field. If you specify auto, Amazon 1226 // Translate will call Amazon Comprehend to determine the source language. 1227 // 1228 // SourceLanguageCode is a required field 1229 SourceLanguageCode *string `min:"2" type:"string" required:"true"` 1230 1231 // The language code requested for the language of the target text. The language 1232 // must be a language supported by Amazon Translate. 1233 // 1234 // TargetLanguageCode is a required field 1235 TargetLanguageCode *string `min:"2" type:"string" required:"true"` 1236 1237 // The TerminologyNames list that is taken as input to the TranslateText request. 1238 // This has a minimum length of 0 and a maximum length of 1. 1239 TerminologyNames []*string `type:"list"` 1240 1241 // The text to translate. The text string can be a maximum of 5,000 bytes long. 1242 // Depending on your character set, this may be fewer than 5,000 characters. 1243 // 1244 // Text is a required field 1245 Text *string `min:"1" type:"string" required:"true"` 1246} 1247 1248// String returns the string representation 1249func (s TextInput) String() string { 1250 return awsutil.Prettify(s) 1251} 1252 1253// GoString returns the string representation 1254func (s TextInput) GoString() string { 1255 return s.String() 1256} 1257 1258// Validate inspects the fields of the type to determine if they are valid. 1259func (s *TextInput) Validate() error { 1260 invalidParams := request.ErrInvalidParams{Context: "TextInput"} 1261 if s.SourceLanguageCode == nil { 1262 invalidParams.Add(request.NewErrParamRequired("SourceLanguageCode")) 1263 } 1264 if s.SourceLanguageCode != nil && len(*s.SourceLanguageCode) < 2 { 1265 invalidParams.Add(request.NewErrParamMinLen("SourceLanguageCode", 2)) 1266 } 1267 if s.TargetLanguageCode == nil { 1268 invalidParams.Add(request.NewErrParamRequired("TargetLanguageCode")) 1269 } 1270 if s.TargetLanguageCode != nil && len(*s.TargetLanguageCode) < 2 { 1271 invalidParams.Add(request.NewErrParamMinLen("TargetLanguageCode", 2)) 1272 } 1273 if s.Text == nil { 1274 invalidParams.Add(request.NewErrParamRequired("Text")) 1275 } 1276 if s.Text != nil && len(*s.Text) < 1 { 1277 invalidParams.Add(request.NewErrParamMinLen("Text", 1)) 1278 } 1279 1280 if invalidParams.Len() > 0 { 1281 return invalidParams 1282 } 1283 return nil 1284} 1285 1286// SetSourceLanguageCode sets the SourceLanguageCode field's value. 1287func (s *TextInput) SetSourceLanguageCode(v string) *TextInput { 1288 s.SourceLanguageCode = &v 1289 return s 1290} 1291 1292// SetTargetLanguageCode sets the TargetLanguageCode field's value. 1293func (s *TextInput) SetTargetLanguageCode(v string) *TextInput { 1294 s.TargetLanguageCode = &v 1295 return s 1296} 1297 1298// SetTerminologyNames sets the TerminologyNames field's value. 1299func (s *TextInput) SetTerminologyNames(v []*string) *TextInput { 1300 s.TerminologyNames = v 1301 return s 1302} 1303 1304// SetText sets the Text field's value. 1305func (s *TextInput) SetText(v string) *TextInput { 1306 s.Text = &v 1307 return s 1308} 1309 1310type TextOutput struct { 1311 _ struct{} `type:"structure"` 1312 1313 // The names of the custom terminologies applied to the input text by Amazon 1314 // Translate for the translated text response. 1315 AppliedTerminologies []*AppliedTerminology `type:"list"` 1316 1317 // The language code for the language of the source text. 1318 // 1319 // SourceLanguageCode is a required field 1320 SourceLanguageCode *string `min:"2" type:"string" required:"true"` 1321 1322 // The language code for the language of the target text. 1323 // 1324 // TargetLanguageCode is a required field 1325 TargetLanguageCode *string `min:"2" type:"string" required:"true"` 1326 1327 // The the translated text. The maximum length of this text is 5kb. 1328 // 1329 // TranslatedText is a required field 1330 TranslatedText *string `type:"string" required:"true"` 1331} 1332 1333// String returns the string representation 1334func (s TextOutput) String() string { 1335 return awsutil.Prettify(s) 1336} 1337 1338// GoString returns the string representation 1339func (s TextOutput) GoString() string { 1340 return s.String() 1341} 1342 1343// SetAppliedTerminologies sets the AppliedTerminologies field's value. 1344func (s *TextOutput) SetAppliedTerminologies(v []*AppliedTerminology) *TextOutput { 1345 s.AppliedTerminologies = v 1346 return s 1347} 1348 1349// SetSourceLanguageCode sets the SourceLanguageCode field's value. 1350func (s *TextOutput) SetSourceLanguageCode(v string) *TextOutput { 1351 s.SourceLanguageCode = &v 1352 return s 1353} 1354 1355// SetTargetLanguageCode sets the TargetLanguageCode field's value. 1356func (s *TextOutput) SetTargetLanguageCode(v string) *TextOutput { 1357 s.TargetLanguageCode = &v 1358 return s 1359} 1360 1361// SetTranslatedText sets the TranslatedText field's value. 1362func (s *TextOutput) SetTranslatedText(v string) *TextOutput { 1363 s.TranslatedText = &v 1364 return s 1365} 1366 1367const ( 1368 // EncryptionKeyTypeKms is a EncryptionKeyType enum value 1369 EncryptionKeyTypeKms = "KMS" 1370) 1371 1372const ( 1373 // MergeStrategyOverwrite is a MergeStrategy enum value 1374 MergeStrategyOverwrite = "OVERWRITE" 1375) 1376 1377const ( 1378 // TerminologyDataFormatCsv is a TerminologyDataFormat enum value 1379 TerminologyDataFormatCsv = "CSV" 1380 1381 // TerminologyDataFormatTmx is a TerminologyDataFormat enum value 1382 TerminologyDataFormatTmx = "TMX" 1383) 1384