merge main
This commit is contained in:
+596
@@ -0,0 +1,596 @@
|
||||
# v1.35.1 (2025-03-04.2)
|
||||
|
||||
* **Bug Fix**: Add assurance test for operation order.
|
||||
|
||||
# v1.35.0 (2025-02-27)
|
||||
|
||||
* **Feature**: Track credential providers via User-Agent Feature ids
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.34.19 (2025-02-18)
|
||||
|
||||
* **Bug Fix**: Bump go version to 1.22
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.34.18 (2025-02-05)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.34.17 (2025-02-04)
|
||||
|
||||
* No change notes available for this release.
|
||||
|
||||
# v1.34.16 (2025-01-31)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.34.15 (2025-01-30)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.34.14 (2025-01-24)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
* **Dependency Update**: Upgrade to smithy-go v1.22.2.
|
||||
|
||||
# v1.34.13 (2025-01-17)
|
||||
|
||||
* **Bug Fix**: Fix bug where credentials weren't refreshed during retry loop.
|
||||
|
||||
# v1.34.12 (2025-01-15)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.34.11 (2025-01-09)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.34.10 (2024-12-19)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.34.9 (2024-12-02)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.34.8 (2024-11-18)
|
||||
|
||||
* **Dependency Update**: Update to smithy-go v1.22.1.
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.34.7 (2024-11-07)
|
||||
|
||||
* **Bug Fix**: Adds case-insensitive handling of error message fields in service responses
|
||||
|
||||
# v1.34.6 (2024-11-06)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.34.5 (2024-10-31)
|
||||
|
||||
* No change notes available for this release.
|
||||
|
||||
# v1.34.4 (2024-10-29)
|
||||
|
||||
* No change notes available for this release.
|
||||
|
||||
# v1.34.3 (2024-10-28)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.34.2 (2024-10-08)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.34.1 (2024-10-07)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.34.0 (2024-10-04)
|
||||
|
||||
* **Feature**: Add support for HTTP client metrics.
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.33.4 (2024-10-03)
|
||||
|
||||
* No change notes available for this release.
|
||||
|
||||
# v1.33.3 (2024-09-27)
|
||||
|
||||
* No change notes available for this release.
|
||||
|
||||
# v1.33.2 (2024-09-25)
|
||||
|
||||
* No change notes available for this release.
|
||||
|
||||
# v1.33.1 (2024-09-23)
|
||||
|
||||
* No change notes available for this release.
|
||||
|
||||
# v1.33.0 (2024-09-20)
|
||||
|
||||
* **Feature**: Add tracing and metrics support to service clients.
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.32.7 (2024-09-17)
|
||||
|
||||
* **Bug Fix**: **BREAKFIX**: Only generate AccountIDEndpointMode config for services that use it. This is a compiler break, but removes no actual functionality, as no services currently use the account ID in endpoint resolution.
|
||||
|
||||
# v1.32.6 (2024-09-04)
|
||||
|
||||
* No change notes available for this release.
|
||||
|
||||
# v1.32.5 (2024-09-03)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.32.4 (2024-08-15)
|
||||
|
||||
* **Dependency Update**: Bump minimum Go version to 1.21.
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.32.3 (2024-07-10.2)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.32.2 (2024-07-10)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.32.1 (2024-06-28)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.32.0 (2024-06-26)
|
||||
|
||||
* **Feature**: Support list-of-string endpoint parameter.
|
||||
|
||||
# v1.31.1 (2024-06-19)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.31.0 (2024-06-18)
|
||||
|
||||
* **Feature**: Track usage of various AWS SDK features in user-agent string.
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.30.12 (2024-06-17)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.30.11 (2024-06-07)
|
||||
|
||||
* **Bug Fix**: Add clock skew correction on all service clients
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.30.10 (2024-06-03)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.30.9 (2024-05-23)
|
||||
|
||||
* No change notes available for this release.
|
||||
|
||||
# v1.30.8 (2024-05-16)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.30.7 (2024-05-15)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.30.6 (2024-05-08)
|
||||
|
||||
* **Bug Fix**: GoDoc improvement
|
||||
|
||||
# v1.30.5 (2024-03-29)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.30.4 (2024-03-18)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.30.3 (2024-03-15)
|
||||
|
||||
* No change notes available for this release.
|
||||
|
||||
# v1.30.2 (2024-03-07)
|
||||
|
||||
* **Bug Fix**: Remove dependency on go-cmp.
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.30.1 (2024-02-23)
|
||||
|
||||
* **Bug Fix**: Move all common, SDK-side middleware stack ops into the service client module to prevent cross-module compatibility issues in the future.
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.30.0 (2024-02-22)
|
||||
|
||||
* **Feature**: Add middleware stack snapshot tests.
|
||||
|
||||
# v1.29.3 (2024-02-21)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.29.2 (2024-02-20)
|
||||
|
||||
* **Bug Fix**: When sourcing values for a service's `EndpointParameters`, the lack of a configured region (i.e. `options.Region == ""`) will now translate to a `nil` value for `EndpointParameters.Region` instead of a pointer to the empty string `""`. This will result in a much more explicit error when calling an operation instead of an obscure hostname lookup failure.
|
||||
|
||||
# v1.29.1 (2024-02-15)
|
||||
|
||||
* **Bug Fix**: Correct failure to determine the error type in awsJson services that could occur when errors were modeled with a non-string `code` field.
|
||||
|
||||
# v1.29.0 (2024-02-13)
|
||||
|
||||
* **Feature**: Bump minimum Go version to 1.20 per our language support policy.
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.28.6 (2024-01-04)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.28.5 (2023-12-08)
|
||||
|
||||
* **Bug Fix**: Reinstate presence of default Retryer in functional options, but still respect max attempts set therein.
|
||||
|
||||
# v1.28.4 (2023-12-07)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.28.3 (2023-12-06)
|
||||
|
||||
* **Bug Fix**: Restore pre-refactor auth behavior where all operations could technically be performed anonymously.
|
||||
|
||||
# v1.28.2 (2023-12-01)
|
||||
|
||||
* **Bug Fix**: Correct wrapping of errors in authentication workflow.
|
||||
* **Bug Fix**: Correctly recognize cache-wrapped instances of AnonymousCredentials at client construction.
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.28.1 (2023-11-30)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.28.0 (2023-11-29)
|
||||
|
||||
* **Feature**: Expose Options() accessor on service clients.
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.27.5 (2023-11-28.2)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.27.4 (2023-11-28)
|
||||
|
||||
* **Bug Fix**: Respect setting RetryMaxAttempts in functional options at client construction.
|
||||
|
||||
# v1.27.3 (2023-11-20)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.27.2 (2023-11-15)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.27.1 (2023-11-09)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.27.0 (2023-11-01)
|
||||
|
||||
* **Feature**: Adds support for configured endpoints via environment variables and the AWS shared configuration file.
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.26.0 (2023-10-31)
|
||||
|
||||
* **Feature**: **BREAKING CHANGE**: Bump minimum go version to 1.19 per the revised [go version support policy](https://aws.amazon.com/blogs/developer/aws-sdk-for-go-aligns-with-go-release-policy-on-supported-runtimes/).
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.25.0 (2023-10-12)
|
||||
|
||||
* **Feature**: This release adds 9 new APIs for adapter and adapter version management, 3 new APIs for tagging, and updates AnalyzeDocument and StartDocumentAnalysis API parameters for using adapters.
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.24.1 (2023-10-06)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.24.0 (2023-09-27)
|
||||
|
||||
* **Feature**: This release adds new feature - Layout to Analyze Document API which can automatically extract layout elements such as titles, paragraphs, headers, section headers, lists, page numbers, footers, table areas, key-value areas and figure areas and order the elements as a human would read.
|
||||
|
||||
# v1.23.0 (2023-09-18)
|
||||
|
||||
* **Announcement**: [BREAKFIX] Change in MaxResults datatype from value to pointer type in cognito-sync service.
|
||||
* **Feature**: Adds several endpoint ruleset changes across all models: smaller rulesets, removed non-unique regional endpoints, fixes FIPS and DualStack endpoints, and make region not required in SDK::Endpoint. Additional breakfix to cognito-sync field.
|
||||
|
||||
# v1.22.5 (2023-08-21)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.22.4 (2023-08-18)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.22.3 (2023-08-17)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.22.2 (2023-08-07)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.22.1 (2023-08-01)
|
||||
|
||||
* No change notes available for this release.
|
||||
|
||||
# v1.22.0 (2023-07-31)
|
||||
|
||||
* **Feature**: Adds support for smithy-modeled endpoint resolution. A new rules-based endpoint resolution will be added to the SDK which will supercede and deprecate existing endpoint resolution. Specifically, EndpointResolver will be deprecated while BaseEndpoint and EndpointResolverV2 will take its place. For more information, please see the Endpoints section in our Developer Guide.
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.21.8 (2023-07-28)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.21.7 (2023-07-13)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.21.6 (2023-06-15)
|
||||
|
||||
* No change notes available for this release.
|
||||
|
||||
# v1.21.5 (2023-06-13)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.21.4 (2023-05-04)
|
||||
|
||||
* No change notes available for this release.
|
||||
|
||||
# v1.21.3 (2023-04-24)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.21.2 (2023-04-10)
|
||||
|
||||
* No change notes available for this release.
|
||||
|
||||
# v1.21.1 (2023-04-07)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.21.0 (2023-03-23)
|
||||
|
||||
* **Feature**: The AnalyzeDocument - Tables feature adds support for new elements in the API: table titles, footers, section titles, summary cells/tables, and table type.
|
||||
|
||||
# v1.20.6 (2023-03-21)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.20.5 (2023-03-10)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.20.4 (2023-02-22)
|
||||
|
||||
* **Bug Fix**: Prevent nil pointer dereference when retrieving error codes.
|
||||
|
||||
# v1.20.3 (2023-02-20)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.20.2 (2023-02-15)
|
||||
|
||||
* **Announcement**: When receiving an error response in restJson-based services, an incorrect error type may have been returned based on the content of the response. This has been fixed via PR #2012 tracked in issue #1910.
|
||||
* **Bug Fix**: Correct error type parsing for restJson services.
|
||||
|
||||
# v1.20.1 (2023-02-03)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.20.0 (2023-01-05)
|
||||
|
||||
* **Feature**: Add `ErrorCodeOverride` field to all error structs (aws/smithy-go#401).
|
||||
|
||||
# v1.19.2 (2022-12-15)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.19.1 (2022-12-02)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.19.0 (2022-11-28)
|
||||
|
||||
* **Feature**: This release adds support for classifying and splitting lending documents by type, and extracting information by using the Analyze Lending APIs. This release also includes support for summarized information of the processed lending document package, in addition to per document results.
|
||||
|
||||
# v1.18.0 (2022-11-17)
|
||||
|
||||
* **Feature**: This release adds support for specifying and extracting information from documents using the Signatures feature within Analyze Document API
|
||||
|
||||
# v1.17.0 (2022-11-01)
|
||||
|
||||
* **Feature**: Add ocr results in AnalyzeIDResponse as blocks
|
||||
|
||||
# v1.16.0 (2022-10-31)
|
||||
|
||||
* **Feature**: This release introduces additional support for 30+ normalized fields such as vendor address and currency. It also includes OCR output in the response and accuracy improvements for the already supported fields in previous version
|
||||
|
||||
# v1.15.16 (2022-10-24)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.15.15 (2022-10-21)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.15.14 (2022-09-20)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.15.13 (2022-09-14)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.15.12 (2022-09-02)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.15.11 (2022-08-31)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.15.10 (2022-08-29)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.15.9 (2022-08-11)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.15.8 (2022-08-09)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.15.7 (2022-08-08)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.15.6 (2022-08-01)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.15.5 (2022-07-05)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.15.4 (2022-06-29)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.15.3 (2022-06-07)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.15.2 (2022-05-17)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.15.1 (2022-04-25)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.15.0 (2022-04-19)
|
||||
|
||||
* **Feature**: This release adds support for specifying and extracting information from documents using the Queries feature within Analyze Document API
|
||||
|
||||
# v1.14.3 (2022-03-30)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.14.2 (2022-03-24)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.14.1 (2022-03-23)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.14.0 (2022-03-08)
|
||||
|
||||
* **Feature**: Updated `github.com/aws/smithy-go` to latest version
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.13.0 (2022-02-24)
|
||||
|
||||
* **Feature**: API client updated
|
||||
* **Feature**: Adds RetryMaxAttempts and RetryMod to API client Options. This allows the API clients' default Retryer to be configured from the shared configuration files or environment variables. Adding a new Retry mode of `Adaptive`. `Adaptive` retry mode is an experimental mode, adding client rate limiting when throttles reponses are received from an API. See [retry.AdaptiveMode](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/aws/retry#AdaptiveMode) for more details, and configuration options.
|
||||
* **Feature**: Updated `github.com/aws/smithy-go` to latest version
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.12.0 (2022-01-14)
|
||||
|
||||
* **Feature**: Updated `github.com/aws/smithy-go` to latest version
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.11.0 (2022-01-07)
|
||||
|
||||
* **Feature**: Updated `github.com/aws/smithy-go` to latest version
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.10.1 (2021-12-02)
|
||||
|
||||
* **Bug Fix**: Fixes a bug that prevented aws.EndpointResolverWithOptions from being used by the service client. ([#1514](https://github.com/aws/aws-sdk-go-v2/pull/1514))
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.10.0 (2021-11-30)
|
||||
|
||||
* **Feature**: API client updated
|
||||
|
||||
# v1.9.1 (2021-11-19)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.9.0 (2021-11-12)
|
||||
|
||||
* **Feature**: Service clients now support custom endpoints that have an initial URI path defined.
|
||||
|
||||
# v1.8.0 (2021-11-06)
|
||||
|
||||
* **Feature**: The SDK now supports configuration of FIPS and DualStack endpoints using environment variables, shared configuration, or programmatically.
|
||||
* **Feature**: Updated `github.com/aws/smithy-go` to latest version
|
||||
* **Feature**: Updated service to latest API model.
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.7.0 (2021-10-21)
|
||||
|
||||
* **Feature**: Updated to latest version
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.6.0 (2021-10-11)
|
||||
|
||||
* **Feature**: API client updated
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.5.1 (2021-09-17)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.5.0 (2021-08-27)
|
||||
|
||||
* **Feature**: Updated API model to latest revision.
|
||||
* **Feature**: Updated `github.com/aws/smithy-go` to latest version
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.4.1 (2021-08-19)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.4.0 (2021-08-04)
|
||||
|
||||
* **Feature**: Updated to latest API model.
|
||||
* **Dependency Update**: Updated `github.com/aws/smithy-go` to latest version.
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.3.1 (2021-07-15)
|
||||
|
||||
* **Dependency Update**: Updated `github.com/aws/smithy-go` to latest version
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.3.0 (2021-06-25)
|
||||
|
||||
* **Feature**: Updated `github.com/aws/smithy-go` to latest version
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.2.1 (2021-05-20)
|
||||
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
# v1.2.0 (2021-05-14)
|
||||
|
||||
* **Feature**: Constant has been added to modules to enable runtime version inspection for reporting.
|
||||
* **Dependency Update**: Updated to the latest SDK module versions
|
||||
|
||||
+202
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
+959
@@ -0,0 +1,959 @@
|
||||
// Code generated by smithy-go-codegen DO NOT EDIT.
|
||||
|
||||
package textract
|
||||
|
||||
import (
|
||||
"context"
|
||||
cryptorand "crypto/rand"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/aws/aws-sdk-go-v2/aws"
|
||||
"github.com/aws/aws-sdk-go-v2/aws/defaults"
|
||||
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
|
||||
"github.com/aws/aws-sdk-go-v2/aws/retry"
|
||||
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
|
||||
awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http"
|
||||
internalauth "github.com/aws/aws-sdk-go-v2/internal/auth"
|
||||
internalauthsmithy "github.com/aws/aws-sdk-go-v2/internal/auth/smithy"
|
||||
internalConfig "github.com/aws/aws-sdk-go-v2/internal/configsources"
|
||||
internalmiddleware "github.com/aws/aws-sdk-go-v2/internal/middleware"
|
||||
smithy "github.com/aws/smithy-go"
|
||||
smithyauth "github.com/aws/smithy-go/auth"
|
||||
smithydocument "github.com/aws/smithy-go/document"
|
||||
"github.com/aws/smithy-go/logging"
|
||||
"github.com/aws/smithy-go/metrics"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
smithyrand "github.com/aws/smithy-go/rand"
|
||||
"github.com/aws/smithy-go/tracing"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
"net"
|
||||
"net/http"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
)
|
||||
|
||||
const ServiceID = "Textract"
|
||||
const ServiceAPIVersion = "2018-06-27"
|
||||
|
||||
type operationMetrics struct {
|
||||
Duration metrics.Float64Histogram
|
||||
SerializeDuration metrics.Float64Histogram
|
||||
ResolveIdentityDuration metrics.Float64Histogram
|
||||
ResolveEndpointDuration metrics.Float64Histogram
|
||||
SignRequestDuration metrics.Float64Histogram
|
||||
DeserializeDuration metrics.Float64Histogram
|
||||
}
|
||||
|
||||
func (m *operationMetrics) histogramFor(name string) metrics.Float64Histogram {
|
||||
switch name {
|
||||
case "client.call.duration":
|
||||
return m.Duration
|
||||
case "client.call.serialization_duration":
|
||||
return m.SerializeDuration
|
||||
case "client.call.resolve_identity_duration":
|
||||
return m.ResolveIdentityDuration
|
||||
case "client.call.resolve_endpoint_duration":
|
||||
return m.ResolveEndpointDuration
|
||||
case "client.call.signing_duration":
|
||||
return m.SignRequestDuration
|
||||
case "client.call.deserialization_duration":
|
||||
return m.DeserializeDuration
|
||||
default:
|
||||
panic("unrecognized operation metric")
|
||||
}
|
||||
}
|
||||
|
||||
func timeOperationMetric[T any](
|
||||
ctx context.Context, metric string, fn func() (T, error),
|
||||
opts ...metrics.RecordMetricOption,
|
||||
) (T, error) {
|
||||
instr := getOperationMetrics(ctx).histogramFor(metric)
|
||||
opts = append([]metrics.RecordMetricOption{withOperationMetadata(ctx)}, opts...)
|
||||
|
||||
start := time.Now()
|
||||
v, err := fn()
|
||||
end := time.Now()
|
||||
|
||||
elapsed := end.Sub(start)
|
||||
instr.Record(ctx, float64(elapsed)/1e9, opts...)
|
||||
return v, err
|
||||
}
|
||||
|
||||
func startMetricTimer(ctx context.Context, metric string, opts ...metrics.RecordMetricOption) func() {
|
||||
instr := getOperationMetrics(ctx).histogramFor(metric)
|
||||
opts = append([]metrics.RecordMetricOption{withOperationMetadata(ctx)}, opts...)
|
||||
|
||||
var ended bool
|
||||
start := time.Now()
|
||||
return func() {
|
||||
if ended {
|
||||
return
|
||||
}
|
||||
ended = true
|
||||
|
||||
end := time.Now()
|
||||
|
||||
elapsed := end.Sub(start)
|
||||
instr.Record(ctx, float64(elapsed)/1e9, opts...)
|
||||
}
|
||||
}
|
||||
|
||||
func withOperationMetadata(ctx context.Context) metrics.RecordMetricOption {
|
||||
return func(o *metrics.RecordMetricOptions) {
|
||||
o.Properties.Set("rpc.service", middleware.GetServiceID(ctx))
|
||||
o.Properties.Set("rpc.method", middleware.GetOperationName(ctx))
|
||||
}
|
||||
}
|
||||
|
||||
type operationMetricsKey struct{}
|
||||
|
||||
func withOperationMetrics(parent context.Context, mp metrics.MeterProvider) (context.Context, error) {
|
||||
meter := mp.Meter("github.com/aws/aws-sdk-go-v2/service/textract")
|
||||
om := &operationMetrics{}
|
||||
|
||||
var err error
|
||||
|
||||
om.Duration, err = operationMetricTimer(meter, "client.call.duration",
|
||||
"Overall call duration (including retries and time to send or receive request and response body)")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
om.SerializeDuration, err = operationMetricTimer(meter, "client.call.serialization_duration",
|
||||
"The time it takes to serialize a message body")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
om.ResolveIdentityDuration, err = operationMetricTimer(meter, "client.call.auth.resolve_identity_duration",
|
||||
"The time taken to acquire an identity (AWS credentials, bearer token, etc) from an Identity Provider")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
om.ResolveEndpointDuration, err = operationMetricTimer(meter, "client.call.resolve_endpoint_duration",
|
||||
"The time it takes to resolve an endpoint (endpoint resolver, not DNS) for the request")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
om.SignRequestDuration, err = operationMetricTimer(meter, "client.call.auth.signing_duration",
|
||||
"The time it takes to sign a request")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
om.DeserializeDuration, err = operationMetricTimer(meter, "client.call.deserialization_duration",
|
||||
"The time it takes to deserialize a message body")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return context.WithValue(parent, operationMetricsKey{}, om), nil
|
||||
}
|
||||
|
||||
func operationMetricTimer(m metrics.Meter, name, desc string) (metrics.Float64Histogram, error) {
|
||||
return m.Float64Histogram(name, func(o *metrics.InstrumentOptions) {
|
||||
o.UnitLabel = "s"
|
||||
o.Description = desc
|
||||
})
|
||||
}
|
||||
|
||||
func getOperationMetrics(ctx context.Context) *operationMetrics {
|
||||
return ctx.Value(operationMetricsKey{}).(*operationMetrics)
|
||||
}
|
||||
|
||||
func operationTracer(p tracing.TracerProvider) tracing.Tracer {
|
||||
return p.Tracer("github.com/aws/aws-sdk-go-v2/service/textract")
|
||||
}
|
||||
|
||||
// Client provides the API client to make operations call for Amazon Textract.
|
||||
type Client struct {
|
||||
options Options
|
||||
|
||||
// Difference between the time reported by the server and the client
|
||||
timeOffset *atomic.Int64
|
||||
}
|
||||
|
||||
// New returns an initialized Client based on the functional options. Provide
|
||||
// additional functional options to further configure the behavior of the client,
|
||||
// such as changing the client's endpoint or adding custom middleware behavior.
|
||||
func New(options Options, optFns ...func(*Options)) *Client {
|
||||
options = options.Copy()
|
||||
|
||||
resolveDefaultLogger(&options)
|
||||
|
||||
setResolvedDefaultsMode(&options)
|
||||
|
||||
resolveRetryer(&options)
|
||||
|
||||
resolveHTTPClient(&options)
|
||||
|
||||
resolveHTTPSignerV4(&options)
|
||||
|
||||
resolveIdempotencyTokenProvider(&options)
|
||||
|
||||
resolveEndpointResolverV2(&options)
|
||||
|
||||
resolveTracerProvider(&options)
|
||||
|
||||
resolveMeterProvider(&options)
|
||||
|
||||
resolveAuthSchemeResolver(&options)
|
||||
|
||||
for _, fn := range optFns {
|
||||
fn(&options)
|
||||
}
|
||||
|
||||
finalizeRetryMaxAttempts(&options)
|
||||
|
||||
ignoreAnonymousAuth(&options)
|
||||
|
||||
wrapWithAnonymousAuth(&options)
|
||||
|
||||
resolveAuthSchemes(&options)
|
||||
|
||||
client := &Client{
|
||||
options: options,
|
||||
}
|
||||
|
||||
initializeTimeOffsetResolver(client)
|
||||
|
||||
return client
|
||||
}
|
||||
|
||||
// Options returns a copy of the client configuration.
|
||||
//
|
||||
// Callers SHOULD NOT perform mutations on any inner structures within client
|
||||
// config. Config overrides should instead be made on a per-operation basis through
|
||||
// functional options.
|
||||
func (c *Client) Options() Options {
|
||||
return c.options.Copy()
|
||||
}
|
||||
|
||||
func (c *Client) invokeOperation(
|
||||
ctx context.Context, opID string, params interface{}, optFns []func(*Options), stackFns ...func(*middleware.Stack, Options) error,
|
||||
) (
|
||||
result interface{}, metadata middleware.Metadata, err error,
|
||||
) {
|
||||
ctx = middleware.ClearStackValues(ctx)
|
||||
ctx = middleware.WithServiceID(ctx, ServiceID)
|
||||
ctx = middleware.WithOperationName(ctx, opID)
|
||||
|
||||
stack := middleware.NewStack(opID, smithyhttp.NewStackRequest)
|
||||
options := c.options.Copy()
|
||||
|
||||
for _, fn := range optFns {
|
||||
fn(&options)
|
||||
}
|
||||
|
||||
finalizeOperationRetryMaxAttempts(&options, *c)
|
||||
|
||||
finalizeClientEndpointResolverOptions(&options)
|
||||
|
||||
for _, fn := range stackFns {
|
||||
if err := fn(stack, options); err != nil {
|
||||
return nil, metadata, err
|
||||
}
|
||||
}
|
||||
|
||||
for _, fn := range options.APIOptions {
|
||||
if err := fn(stack); err != nil {
|
||||
return nil, metadata, err
|
||||
}
|
||||
}
|
||||
|
||||
ctx, err = withOperationMetrics(ctx, options.MeterProvider)
|
||||
if err != nil {
|
||||
return nil, metadata, err
|
||||
}
|
||||
|
||||
tracer := operationTracer(options.TracerProvider)
|
||||
spanName := fmt.Sprintf("%s.%s", ServiceID, opID)
|
||||
|
||||
ctx = tracing.WithOperationTracer(ctx, tracer)
|
||||
|
||||
ctx, span := tracer.StartSpan(ctx, spanName, func(o *tracing.SpanOptions) {
|
||||
o.Kind = tracing.SpanKindClient
|
||||
o.Properties.Set("rpc.system", "aws-api")
|
||||
o.Properties.Set("rpc.method", opID)
|
||||
o.Properties.Set("rpc.service", ServiceID)
|
||||
})
|
||||
endTimer := startMetricTimer(ctx, "client.call.duration")
|
||||
defer endTimer()
|
||||
defer span.End()
|
||||
|
||||
handler := smithyhttp.NewClientHandlerWithOptions(options.HTTPClient, func(o *smithyhttp.ClientHandler) {
|
||||
o.Meter = options.MeterProvider.Meter("github.com/aws/aws-sdk-go-v2/service/textract")
|
||||
})
|
||||
decorated := middleware.DecorateHandler(handler, stack)
|
||||
result, metadata, err = decorated.Handle(ctx, params)
|
||||
if err != nil {
|
||||
span.SetProperty("exception.type", fmt.Sprintf("%T", err))
|
||||
span.SetProperty("exception.message", err.Error())
|
||||
|
||||
var aerr smithy.APIError
|
||||
if errors.As(err, &aerr) {
|
||||
span.SetProperty("api.error_code", aerr.ErrorCode())
|
||||
span.SetProperty("api.error_message", aerr.ErrorMessage())
|
||||
span.SetProperty("api.error_fault", aerr.ErrorFault().String())
|
||||
}
|
||||
|
||||
err = &smithy.OperationError{
|
||||
ServiceID: ServiceID,
|
||||
OperationName: opID,
|
||||
Err: err,
|
||||
}
|
||||
}
|
||||
|
||||
span.SetProperty("error", err != nil)
|
||||
if err == nil {
|
||||
span.SetStatus(tracing.SpanStatusOK)
|
||||
} else {
|
||||
span.SetStatus(tracing.SpanStatusError)
|
||||
}
|
||||
|
||||
return result, metadata, err
|
||||
}
|
||||
|
||||
type operationInputKey struct{}
|
||||
|
||||
func setOperationInput(ctx context.Context, input interface{}) context.Context {
|
||||
return middleware.WithStackValue(ctx, operationInputKey{}, input)
|
||||
}
|
||||
|
||||
func getOperationInput(ctx context.Context) interface{} {
|
||||
return middleware.GetStackValue(ctx, operationInputKey{})
|
||||
}
|
||||
|
||||
type setOperationInputMiddleware struct {
|
||||
}
|
||||
|
||||
func (*setOperationInputMiddleware) ID() string {
|
||||
return "setOperationInput"
|
||||
}
|
||||
|
||||
func (m *setOperationInputMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
|
||||
out middleware.SerializeOutput, metadata middleware.Metadata, err error,
|
||||
) {
|
||||
ctx = setOperationInput(ctx, in.Parameters)
|
||||
return next.HandleSerialize(ctx, in)
|
||||
}
|
||||
|
||||
func addProtocolFinalizerMiddlewares(stack *middleware.Stack, options Options, operation string) error {
|
||||
if err := stack.Finalize.Add(&resolveAuthSchemeMiddleware{operation: operation, options: options}, middleware.Before); err != nil {
|
||||
return fmt.Errorf("add ResolveAuthScheme: %w", err)
|
||||
}
|
||||
if err := stack.Finalize.Insert(&getIdentityMiddleware{options: options}, "ResolveAuthScheme", middleware.After); err != nil {
|
||||
return fmt.Errorf("add GetIdentity: %v", err)
|
||||
}
|
||||
if err := stack.Finalize.Insert(&resolveEndpointV2Middleware{options: options}, "GetIdentity", middleware.After); err != nil {
|
||||
return fmt.Errorf("add ResolveEndpointV2: %v", err)
|
||||
}
|
||||
if err := stack.Finalize.Insert(&signRequestMiddleware{options: options}, "ResolveEndpointV2", middleware.After); err != nil {
|
||||
return fmt.Errorf("add Signing: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func resolveAuthSchemeResolver(options *Options) {
|
||||
if options.AuthSchemeResolver == nil {
|
||||
options.AuthSchemeResolver = &defaultAuthSchemeResolver{}
|
||||
}
|
||||
}
|
||||
|
||||
func resolveAuthSchemes(options *Options) {
|
||||
if options.AuthSchemes == nil {
|
||||
options.AuthSchemes = []smithyhttp.AuthScheme{
|
||||
internalauth.NewHTTPAuthScheme("aws.auth#sigv4", &internalauthsmithy.V4SignerAdapter{
|
||||
Signer: options.HTTPSignerV4,
|
||||
Logger: options.Logger,
|
||||
LogSigning: options.ClientLogMode.IsSigning(),
|
||||
}),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type noSmithyDocumentSerde = smithydocument.NoSerde
|
||||
|
||||
type legacyEndpointContextSetter struct {
|
||||
LegacyResolver EndpointResolver
|
||||
}
|
||||
|
||||
func (*legacyEndpointContextSetter) ID() string {
|
||||
return "legacyEndpointContextSetter"
|
||||
}
|
||||
|
||||
func (m *legacyEndpointContextSetter) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
|
||||
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
|
||||
) {
|
||||
if m.LegacyResolver != nil {
|
||||
ctx = awsmiddleware.SetRequiresLegacyEndpoints(ctx, true)
|
||||
}
|
||||
|
||||
return next.HandleInitialize(ctx, in)
|
||||
|
||||
}
|
||||
func addlegacyEndpointContextSetter(stack *middleware.Stack, o Options) error {
|
||||
return stack.Initialize.Add(&legacyEndpointContextSetter{
|
||||
LegacyResolver: o.EndpointResolver,
|
||||
}, middleware.Before)
|
||||
}
|
||||
|
||||
func resolveDefaultLogger(o *Options) {
|
||||
if o.Logger != nil {
|
||||
return
|
||||
}
|
||||
o.Logger = logging.Nop{}
|
||||
}
|
||||
|
||||
func addSetLoggerMiddleware(stack *middleware.Stack, o Options) error {
|
||||
return middleware.AddSetLoggerMiddleware(stack, o.Logger)
|
||||
}
|
||||
|
||||
func setResolvedDefaultsMode(o *Options) {
|
||||
if len(o.resolvedDefaultsMode) > 0 {
|
||||
return
|
||||
}
|
||||
|
||||
var mode aws.DefaultsMode
|
||||
mode.SetFromString(string(o.DefaultsMode))
|
||||
|
||||
if mode == aws.DefaultsModeAuto {
|
||||
mode = defaults.ResolveDefaultsModeAuto(o.Region, o.RuntimeEnvironment)
|
||||
}
|
||||
|
||||
o.resolvedDefaultsMode = mode
|
||||
}
|
||||
|
||||
// NewFromConfig returns a new client from the provided config.
|
||||
func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client {
|
||||
opts := Options{
|
||||
Region: cfg.Region,
|
||||
DefaultsMode: cfg.DefaultsMode,
|
||||
RuntimeEnvironment: cfg.RuntimeEnvironment,
|
||||
HTTPClient: cfg.HTTPClient,
|
||||
Credentials: cfg.Credentials,
|
||||
APIOptions: cfg.APIOptions,
|
||||
Logger: cfg.Logger,
|
||||
ClientLogMode: cfg.ClientLogMode,
|
||||
AppID: cfg.AppID,
|
||||
}
|
||||
resolveAWSRetryerProvider(cfg, &opts)
|
||||
resolveAWSRetryMaxAttempts(cfg, &opts)
|
||||
resolveAWSRetryMode(cfg, &opts)
|
||||
resolveAWSEndpointResolver(cfg, &opts)
|
||||
resolveUseDualStackEndpoint(cfg, &opts)
|
||||
resolveUseFIPSEndpoint(cfg, &opts)
|
||||
resolveBaseEndpoint(cfg, &opts)
|
||||
return New(opts, optFns...)
|
||||
}
|
||||
|
||||
func resolveHTTPClient(o *Options) {
|
||||
var buildable *awshttp.BuildableClient
|
||||
|
||||
if o.HTTPClient != nil {
|
||||
var ok bool
|
||||
buildable, ok = o.HTTPClient.(*awshttp.BuildableClient)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
buildable = awshttp.NewBuildableClient()
|
||||
}
|
||||
|
||||
modeConfig, err := defaults.GetModeConfiguration(o.resolvedDefaultsMode)
|
||||
if err == nil {
|
||||
buildable = buildable.WithDialerOptions(func(dialer *net.Dialer) {
|
||||
if dialerTimeout, ok := modeConfig.GetConnectTimeout(); ok {
|
||||
dialer.Timeout = dialerTimeout
|
||||
}
|
||||
})
|
||||
|
||||
buildable = buildable.WithTransportOptions(func(transport *http.Transport) {
|
||||
if tlsHandshakeTimeout, ok := modeConfig.GetTLSNegotiationTimeout(); ok {
|
||||
transport.TLSHandshakeTimeout = tlsHandshakeTimeout
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
o.HTTPClient = buildable
|
||||
}
|
||||
|
||||
func resolveRetryer(o *Options) {
|
||||
if o.Retryer != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if len(o.RetryMode) == 0 {
|
||||
modeConfig, err := defaults.GetModeConfiguration(o.resolvedDefaultsMode)
|
||||
if err == nil {
|
||||
o.RetryMode = modeConfig.RetryMode
|
||||
}
|
||||
}
|
||||
if len(o.RetryMode) == 0 {
|
||||
o.RetryMode = aws.RetryModeStandard
|
||||
}
|
||||
|
||||
var standardOptions []func(*retry.StandardOptions)
|
||||
if v := o.RetryMaxAttempts; v != 0 {
|
||||
standardOptions = append(standardOptions, func(so *retry.StandardOptions) {
|
||||
so.MaxAttempts = v
|
||||
})
|
||||
}
|
||||
|
||||
switch o.RetryMode {
|
||||
case aws.RetryModeAdaptive:
|
||||
var adaptiveOptions []func(*retry.AdaptiveModeOptions)
|
||||
if len(standardOptions) != 0 {
|
||||
adaptiveOptions = append(adaptiveOptions, func(ao *retry.AdaptiveModeOptions) {
|
||||
ao.StandardOptions = append(ao.StandardOptions, standardOptions...)
|
||||
})
|
||||
}
|
||||
o.Retryer = retry.NewAdaptiveMode(adaptiveOptions...)
|
||||
|
||||
default:
|
||||
o.Retryer = retry.NewStandard(standardOptions...)
|
||||
}
|
||||
}
|
||||
|
||||
func resolveAWSRetryerProvider(cfg aws.Config, o *Options) {
|
||||
if cfg.Retryer == nil {
|
||||
return
|
||||
}
|
||||
o.Retryer = cfg.Retryer()
|
||||
}
|
||||
|
||||
func resolveAWSRetryMode(cfg aws.Config, o *Options) {
|
||||
if len(cfg.RetryMode) == 0 {
|
||||
return
|
||||
}
|
||||
o.RetryMode = cfg.RetryMode
|
||||
}
|
||||
func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) {
|
||||
if cfg.RetryMaxAttempts == 0 {
|
||||
return
|
||||
}
|
||||
o.RetryMaxAttempts = cfg.RetryMaxAttempts
|
||||
}
|
||||
|
||||
func finalizeRetryMaxAttempts(o *Options) {
|
||||
if o.RetryMaxAttempts == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts)
|
||||
}
|
||||
|
||||
func finalizeOperationRetryMaxAttempts(o *Options, client Client) {
|
||||
if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts {
|
||||
return
|
||||
}
|
||||
|
||||
o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts)
|
||||
}
|
||||
|
||||
func resolveAWSEndpointResolver(cfg aws.Config, o *Options) {
|
||||
if cfg.EndpointResolver == nil && cfg.EndpointResolverWithOptions == nil {
|
||||
return
|
||||
}
|
||||
o.EndpointResolver = withEndpointResolver(cfg.EndpointResolver, cfg.EndpointResolverWithOptions)
|
||||
}
|
||||
|
||||
func addClientUserAgent(stack *middleware.Stack, options Options) error {
|
||||
ua, err := getOrAddRequestUserAgent(stack)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ua.AddSDKAgentKeyValue(awsmiddleware.APIMetadata, "textract", goModuleVersion)
|
||||
if len(options.AppID) > 0 {
|
||||
ua.AddSDKAgentKey(awsmiddleware.ApplicationIdentifier, options.AppID)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func getOrAddRequestUserAgent(stack *middleware.Stack) (*awsmiddleware.RequestUserAgent, error) {
|
||||
id := (*awsmiddleware.RequestUserAgent)(nil).ID()
|
||||
mw, ok := stack.Build.Get(id)
|
||||
if !ok {
|
||||
mw = awsmiddleware.NewRequestUserAgent()
|
||||
if err := stack.Build.Add(mw, middleware.After); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
ua, ok := mw.(*awsmiddleware.RequestUserAgent)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("%T for %s middleware did not match expected type", mw, id)
|
||||
}
|
||||
|
||||
return ua, nil
|
||||
}
|
||||
|
||||
type HTTPSignerV4 interface {
|
||||
SignHTTP(ctx context.Context, credentials aws.Credentials, r *http.Request, payloadHash string, service string, region string, signingTime time.Time, optFns ...func(*v4.SignerOptions)) error
|
||||
}
|
||||
|
||||
func resolveHTTPSignerV4(o *Options) {
|
||||
if o.HTTPSignerV4 != nil {
|
||||
return
|
||||
}
|
||||
o.HTTPSignerV4 = newDefaultV4Signer(*o)
|
||||
}
|
||||
|
||||
func newDefaultV4Signer(o Options) *v4.Signer {
|
||||
return v4.NewSigner(func(so *v4.SignerOptions) {
|
||||
so.Logger = o.Logger
|
||||
so.LogSigning = o.ClientLogMode.IsSigning()
|
||||
})
|
||||
}
|
||||
|
||||
func addClientRequestID(stack *middleware.Stack) error {
|
||||
return stack.Build.Add(&awsmiddleware.ClientRequestID{}, middleware.After)
|
||||
}
|
||||
|
||||
func addComputeContentLength(stack *middleware.Stack) error {
|
||||
return stack.Build.Add(&smithyhttp.ComputeContentLength{}, middleware.After)
|
||||
}
|
||||
|
||||
func addRawResponseToMetadata(stack *middleware.Stack) error {
|
||||
return stack.Deserialize.Add(&awsmiddleware.AddRawResponse{}, middleware.Before)
|
||||
}
|
||||
|
||||
func addRecordResponseTiming(stack *middleware.Stack) error {
|
||||
return stack.Deserialize.Add(&awsmiddleware.RecordResponseTiming{}, middleware.After)
|
||||
}
|
||||
|
||||
func addSpanRetryLoop(stack *middleware.Stack, options Options) error {
|
||||
return stack.Finalize.Insert(&spanRetryLoop{options: options}, "Retry", middleware.Before)
|
||||
}
|
||||
|
||||
type spanRetryLoop struct {
|
||||
options Options
|
||||
}
|
||||
|
||||
func (*spanRetryLoop) ID() string {
|
||||
return "spanRetryLoop"
|
||||
}
|
||||
|
||||
func (m *spanRetryLoop) HandleFinalize(
|
||||
ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler,
|
||||
) (
|
||||
middleware.FinalizeOutput, middleware.Metadata, error,
|
||||
) {
|
||||
tracer := operationTracer(m.options.TracerProvider)
|
||||
ctx, span := tracer.StartSpan(ctx, "RetryLoop")
|
||||
defer span.End()
|
||||
|
||||
return next.HandleFinalize(ctx, in)
|
||||
}
|
||||
func addStreamingEventsPayload(stack *middleware.Stack) error {
|
||||
return stack.Finalize.Add(&v4.StreamingEventsPayload{}, middleware.Before)
|
||||
}
|
||||
|
||||
func addUnsignedPayload(stack *middleware.Stack) error {
|
||||
return stack.Finalize.Insert(&v4.UnsignedPayload{}, "ResolveEndpointV2", middleware.After)
|
||||
}
|
||||
|
||||
func addComputePayloadSHA256(stack *middleware.Stack) error {
|
||||
return stack.Finalize.Insert(&v4.ComputePayloadSHA256{}, "ResolveEndpointV2", middleware.After)
|
||||
}
|
||||
|
||||
func addContentSHA256Header(stack *middleware.Stack) error {
|
||||
return stack.Finalize.Insert(&v4.ContentSHA256Header{}, (*v4.ComputePayloadSHA256)(nil).ID(), middleware.After)
|
||||
}
|
||||
|
||||
func addIsWaiterUserAgent(o *Options) {
|
||||
o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error {
|
||||
ua, err := getOrAddRequestUserAgent(stack)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ua.AddUserAgentFeature(awsmiddleware.UserAgentFeatureWaiter)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func addIsPaginatorUserAgent(o *Options) {
|
||||
o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error {
|
||||
ua, err := getOrAddRequestUserAgent(stack)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ua.AddUserAgentFeature(awsmiddleware.UserAgentFeaturePaginator)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func resolveIdempotencyTokenProvider(o *Options) {
|
||||
if o.IdempotencyTokenProvider != nil {
|
||||
return
|
||||
}
|
||||
o.IdempotencyTokenProvider = smithyrand.NewUUIDIdempotencyToken(cryptorand.Reader)
|
||||
}
|
||||
|
||||
func addRetry(stack *middleware.Stack, o Options) error {
|
||||
attempt := retry.NewAttemptMiddleware(o.Retryer, smithyhttp.RequestCloner, func(m *retry.Attempt) {
|
||||
m.LogAttempts = o.ClientLogMode.IsRetries()
|
||||
m.OperationMeter = o.MeterProvider.Meter("github.com/aws/aws-sdk-go-v2/service/textract")
|
||||
})
|
||||
if err := stack.Finalize.Insert(attempt, "ResolveAuthScheme", middleware.Before); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := stack.Finalize.Insert(&retry.MetricsHeader{}, attempt.ID(), middleware.After); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// resolves dual-stack endpoint configuration
|
||||
func resolveUseDualStackEndpoint(cfg aws.Config, o *Options) error {
|
||||
if len(cfg.ConfigSources) == 0 {
|
||||
return nil
|
||||
}
|
||||
value, found, err := internalConfig.ResolveUseDualStackEndpoint(context.Background(), cfg.ConfigSources)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if found {
|
||||
o.EndpointOptions.UseDualStackEndpoint = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// resolves FIPS endpoint configuration
|
||||
func resolveUseFIPSEndpoint(cfg aws.Config, o *Options) error {
|
||||
if len(cfg.ConfigSources) == 0 {
|
||||
return nil
|
||||
}
|
||||
value, found, err := internalConfig.ResolveUseFIPSEndpoint(context.Background(), cfg.ConfigSources)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if found {
|
||||
o.EndpointOptions.UseFIPSEndpoint = value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func resolveAccountID(identity smithyauth.Identity, mode aws.AccountIDEndpointMode) *string {
|
||||
if mode == aws.AccountIDEndpointModeDisabled {
|
||||
return nil
|
||||
}
|
||||
|
||||
if ca, ok := identity.(*internalauthsmithy.CredentialsAdapter); ok && ca.Credentials.AccountID != "" {
|
||||
return aws.String(ca.Credentials.AccountID)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func addTimeOffsetBuild(stack *middleware.Stack, c *Client) error {
|
||||
mw := internalmiddleware.AddTimeOffsetMiddleware{Offset: c.timeOffset}
|
||||
if err := stack.Build.Add(&mw, middleware.After); err != nil {
|
||||
return err
|
||||
}
|
||||
return stack.Deserialize.Insert(&mw, "RecordResponseTiming", middleware.Before)
|
||||
}
|
||||
func initializeTimeOffsetResolver(c *Client) {
|
||||
c.timeOffset = new(atomic.Int64)
|
||||
}
|
||||
|
||||
func addUserAgentRetryMode(stack *middleware.Stack, options Options) error {
|
||||
ua, err := getOrAddRequestUserAgent(stack)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
switch options.Retryer.(type) {
|
||||
case *retry.Standard:
|
||||
ua.AddUserAgentFeature(awsmiddleware.UserAgentFeatureRetryModeStandard)
|
||||
case *retry.AdaptiveMode:
|
||||
ua.AddUserAgentFeature(awsmiddleware.UserAgentFeatureRetryModeAdaptive)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type setCredentialSourceMiddleware struct {
|
||||
ua *awsmiddleware.RequestUserAgent
|
||||
options Options
|
||||
}
|
||||
|
||||
func (m setCredentialSourceMiddleware) ID() string { return "SetCredentialSourceMiddleware" }
|
||||
|
||||
func (m setCredentialSourceMiddleware) HandleBuild(ctx context.Context, in middleware.BuildInput, next middleware.BuildHandler) (
|
||||
out middleware.BuildOutput, metadata middleware.Metadata, err error,
|
||||
) {
|
||||
asProviderSource, ok := m.options.Credentials.(aws.CredentialProviderSource)
|
||||
if !ok {
|
||||
return next.HandleBuild(ctx, in)
|
||||
}
|
||||
providerSources := asProviderSource.ProviderSources()
|
||||
for _, source := range providerSources {
|
||||
m.ua.AddCredentialsSource(source)
|
||||
}
|
||||
return next.HandleBuild(ctx, in)
|
||||
}
|
||||
|
||||
func addCredentialSource(stack *middleware.Stack, options Options) error {
|
||||
ua, err := getOrAddRequestUserAgent(stack)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
mw := setCredentialSourceMiddleware{ua: ua, options: options}
|
||||
return stack.Build.Insert(&mw, "UserAgent", middleware.Before)
|
||||
}
|
||||
|
||||
func resolveTracerProvider(options *Options) {
|
||||
if options.TracerProvider == nil {
|
||||
options.TracerProvider = &tracing.NopTracerProvider{}
|
||||
}
|
||||
}
|
||||
|
||||
func resolveMeterProvider(options *Options) {
|
||||
if options.MeterProvider == nil {
|
||||
options.MeterProvider = metrics.NopMeterProvider{}
|
||||
}
|
||||
}
|
||||
|
||||
// IdempotencyTokenProvider interface for providing idempotency token
|
||||
type IdempotencyTokenProvider interface {
|
||||
GetIdempotencyToken() (string, error)
|
||||
}
|
||||
|
||||
func addRecursionDetection(stack *middleware.Stack) error {
|
||||
return stack.Build.Add(&awsmiddleware.RecursionDetection{}, middleware.After)
|
||||
}
|
||||
|
||||
func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error {
|
||||
return stack.Deserialize.Insert(&awsmiddleware.RequestIDRetriever{}, "OperationDeserializer", middleware.Before)
|
||||
|
||||
}
|
||||
|
||||
func addResponseErrorMiddleware(stack *middleware.Stack) error {
|
||||
return stack.Deserialize.Insert(&awshttp.ResponseErrorWrapper{}, "RequestIDRetriever", middleware.Before)
|
||||
|
||||
}
|
||||
|
||||
func addRequestResponseLogging(stack *middleware.Stack, o Options) error {
|
||||
return stack.Deserialize.Add(&smithyhttp.RequestResponseLogger{
|
||||
LogRequest: o.ClientLogMode.IsRequest(),
|
||||
LogRequestWithBody: o.ClientLogMode.IsRequestWithBody(),
|
||||
LogResponse: o.ClientLogMode.IsResponse(),
|
||||
LogResponseWithBody: o.ClientLogMode.IsResponseWithBody(),
|
||||
}, middleware.After)
|
||||
}
|
||||
|
||||
type disableHTTPSMiddleware struct {
|
||||
DisableHTTPS bool
|
||||
}
|
||||
|
||||
func (*disableHTTPSMiddleware) ID() string {
|
||||
return "disableHTTPS"
|
||||
}
|
||||
|
||||
func (m *disableHTTPSMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) (
|
||||
out middleware.FinalizeOutput, metadata middleware.Metadata, err error,
|
||||
) {
|
||||
req, ok := in.Request.(*smithyhttp.Request)
|
||||
if !ok {
|
||||
return out, metadata, fmt.Errorf("unknown transport type %T", in.Request)
|
||||
}
|
||||
|
||||
if m.DisableHTTPS && !smithyhttp.GetHostnameImmutable(ctx) {
|
||||
req.URL.Scheme = "http"
|
||||
}
|
||||
|
||||
return next.HandleFinalize(ctx, in)
|
||||
}
|
||||
|
||||
func addDisableHTTPSMiddleware(stack *middleware.Stack, o Options) error {
|
||||
return stack.Finalize.Insert(&disableHTTPSMiddleware{
|
||||
DisableHTTPS: o.EndpointOptions.DisableHTTPS,
|
||||
}, "ResolveEndpointV2", middleware.After)
|
||||
}
|
||||
|
||||
type spanInitializeStart struct {
|
||||
}
|
||||
|
||||
func (*spanInitializeStart) ID() string {
|
||||
return "spanInitializeStart"
|
||||
}
|
||||
|
||||
func (m *spanInitializeStart) HandleInitialize(
|
||||
ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler,
|
||||
) (
|
||||
middleware.InitializeOutput, middleware.Metadata, error,
|
||||
) {
|
||||
ctx, _ = tracing.StartSpan(ctx, "Initialize")
|
||||
|
||||
return next.HandleInitialize(ctx, in)
|
||||
}
|
||||
|
||||
type spanInitializeEnd struct {
|
||||
}
|
||||
|
||||
func (*spanInitializeEnd) ID() string {
|
||||
return "spanInitializeEnd"
|
||||
}
|
||||
|
||||
func (m *spanInitializeEnd) HandleInitialize(
|
||||
ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler,
|
||||
) (
|
||||
middleware.InitializeOutput, middleware.Metadata, error,
|
||||
) {
|
||||
ctx, span := tracing.PopSpan(ctx)
|
||||
span.End()
|
||||
|
||||
return next.HandleInitialize(ctx, in)
|
||||
}
|
||||
|
||||
type spanBuildRequestStart struct {
|
||||
}
|
||||
|
||||
func (*spanBuildRequestStart) ID() string {
|
||||
return "spanBuildRequestStart"
|
||||
}
|
||||
|
||||
func (m *spanBuildRequestStart) HandleSerialize(
|
||||
ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler,
|
||||
) (
|
||||
middleware.SerializeOutput, middleware.Metadata, error,
|
||||
) {
|
||||
ctx, _ = tracing.StartSpan(ctx, "BuildRequest")
|
||||
|
||||
return next.HandleSerialize(ctx, in)
|
||||
}
|
||||
|
||||
type spanBuildRequestEnd struct {
|
||||
}
|
||||
|
||||
func (*spanBuildRequestEnd) ID() string {
|
||||
return "spanBuildRequestEnd"
|
||||
}
|
||||
|
||||
func (m *spanBuildRequestEnd) HandleBuild(
|
||||
ctx context.Context, in middleware.BuildInput, next middleware.BuildHandler,
|
||||
) (
|
||||
middleware.BuildOutput, middleware.Metadata, error,
|
||||
) {
|
||||
ctx, span := tracing.PopSpan(ctx)
|
||||
span.End()
|
||||
|
||||
return next.HandleBuild(ctx, in)
|
||||
}
|
||||
|
||||
func addSpanInitializeStart(stack *middleware.Stack) error {
|
||||
return stack.Initialize.Add(&spanInitializeStart{}, middleware.Before)
|
||||
}
|
||||
|
||||
func addSpanInitializeEnd(stack *middleware.Stack) error {
|
||||
return stack.Initialize.Add(&spanInitializeEnd{}, middleware.After)
|
||||
}
|
||||
|
||||
func addSpanBuildRequestStart(stack *middleware.Stack) error {
|
||||
return stack.Serialize.Add(&spanBuildRequestStart{}, middleware.Before)
|
||||
}
|
||||
|
||||
func addSpanBuildRequestEnd(stack *middleware.Stack) error {
|
||||
return stack.Build.Add(&spanBuildRequestEnd{}, middleware.After)
|
||||
}
|
||||
+237
@@ -0,0 +1,237 @@
|
||||
// Code generated by smithy-go-codegen DO NOT EDIT.
|
||||
|
||||
package textract
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
|
||||
"github.com/aws/aws-sdk-go-v2/service/textract/types"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
)
|
||||
|
||||
// Analyzes an input document for relationships between detected items.
|
||||
//
|
||||
// The types of information returned are as follows:
|
||||
//
|
||||
// - Form data (key-value pairs). The related information is returned in two Block
|
||||
// objects, each of type KEY_VALUE_SET : a KEY Block object and a VALUE Block
|
||||
// object. For example, Name: Ana Silva Carolina contains a key and value. Name: is
|
||||
// the key. Ana Silva Carolina is the value.
|
||||
//
|
||||
// - Table and table cell data. A TABLE Block object contains information about a
|
||||
// detected table. A CELL Block object is returned for each cell in a table.
|
||||
//
|
||||
// - Lines and words of text. A LINE Block object contains one or more WORD Block
|
||||
// objects. All lines and words that are detected in the document are returned
|
||||
// (including text that doesn't have a relationship with the value of
|
||||
// FeatureTypes ).
|
||||
//
|
||||
// - Signatures. A SIGNATURE Block object contains the location information of a
|
||||
// signature in a document. If used in conjunction with forms or tables, a
|
||||
// signature can be given a Key-Value pairing or be detected in the cell of a
|
||||
// table.
|
||||
//
|
||||
// - Query. A QUERY Block object contains the query text, alias and link to the
|
||||
// associated Query results block object.
|
||||
//
|
||||
// - Query Result. A QUERY_RESULT Block object contains the answer to the query
|
||||
// and an ID that connects it to the query asked. This Block also contains a
|
||||
// confidence score.
|
||||
//
|
||||
// Selection elements such as check boxes and option buttons (radio buttons) can
|
||||
// be detected in form data and in tables. A SELECTION_ELEMENT Block object
|
||||
// contains information about a selection element, including the selection status.
|
||||
//
|
||||
// You can choose which type of analysis to perform by specifying the FeatureTypes
|
||||
// list.
|
||||
//
|
||||
// The output is returned in a list of Block objects.
|
||||
//
|
||||
// AnalyzeDocument is a synchronous operation. To analyze documents
|
||||
// asynchronously, use StartDocumentAnalysis.
|
||||
//
|
||||
// For more information, see [Document Text Analysis].
|
||||
//
|
||||
// [Document Text Analysis]: https://docs.aws.amazon.com/textract/latest/dg/how-it-works-analyzing.html
|
||||
func (c *Client) AnalyzeDocument(ctx context.Context, params *AnalyzeDocumentInput, optFns ...func(*Options)) (*AnalyzeDocumentOutput, error) {
|
||||
if params == nil {
|
||||
params = &AnalyzeDocumentInput{}
|
||||
}
|
||||
|
||||
result, metadata, err := c.invokeOperation(ctx, "AnalyzeDocument", params, optFns, c.addOperationAnalyzeDocumentMiddlewares)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out := result.(*AnalyzeDocumentOutput)
|
||||
out.ResultMetadata = metadata
|
||||
return out, nil
|
||||
}
|
||||
|
||||
type AnalyzeDocumentInput struct {
|
||||
|
||||
// The input document as base64-encoded bytes or an Amazon S3 object. If you use
|
||||
// the AWS CLI to call Amazon Textract operations, you can't pass image bytes. The
|
||||
// document must be an image in JPEG, PNG, PDF, or TIFF format.
|
||||
//
|
||||
// If you're using an AWS SDK to call Amazon Textract, you might not need to
|
||||
// base64-encode image bytes that are passed using the Bytes field.
|
||||
//
|
||||
// This member is required.
|
||||
Document *types.Document
|
||||
|
||||
// A list of the types of analysis to perform. Add TABLES to the list to return
|
||||
// information about the tables that are detected in the input document. Add FORMS
|
||||
// to return detected form data. Add SIGNATURES to return the locations of detected
|
||||
// signatures. Add LAYOUT to the list to return information about the layout of the
|
||||
// document. All lines and words detected in the document are included in the
|
||||
// response (including text that isn't related to the value of FeatureTypes ).
|
||||
//
|
||||
// This member is required.
|
||||
FeatureTypes []types.FeatureType
|
||||
|
||||
// Specifies the adapter to be used when analyzing a document.
|
||||
AdaptersConfig *types.AdaptersConfig
|
||||
|
||||
// Sets the configuration for the human in the loop workflow for analyzing
|
||||
// documents.
|
||||
HumanLoopConfig *types.HumanLoopConfig
|
||||
|
||||
// Contains Queries and the alias for those Queries, as determined by the input.
|
||||
QueriesConfig *types.QueriesConfig
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
type AnalyzeDocumentOutput struct {
|
||||
|
||||
// The version of the model used to analyze the document.
|
||||
AnalyzeDocumentModelVersion *string
|
||||
|
||||
// The items that are detected and analyzed by AnalyzeDocument .
|
||||
Blocks []types.Block
|
||||
|
||||
// Metadata about the analyzed document. An example is the number of pages.
|
||||
DocumentMetadata *types.DocumentMetadata
|
||||
|
||||
// Shows the results of the human in the loop evaluation.
|
||||
HumanLoopActivationOutput *types.HumanLoopActivationOutput
|
||||
|
||||
// Metadata pertaining to the operation's result.
|
||||
ResultMetadata middleware.Metadata
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (c *Client) addOperationAnalyzeDocumentMiddlewares(stack *middleware.Stack, options Options) (err error) {
|
||||
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Serialize.Add(&awsAwsjson11_serializeOpAnalyzeDocument{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpAnalyzeDocument{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := addProtocolFinalizerMiddlewares(stack, options, "AnalyzeDocument"); err != nil {
|
||||
return fmt.Errorf("add protocol finalizers: %v", err)
|
||||
}
|
||||
|
||||
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLoggerMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientRequestID(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputeContentLength(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addResolveEndpointMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputePayloadSHA256(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRetry(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRawResponseToMetadata(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecordResponseTiming(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanRetryLoop(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientUserAgent(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addTimeOffsetBuild(stack, c); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addUserAgentRetryMode(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addCredentialSource(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addOpAnalyzeDocumentValidationMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAnalyzeDocument(options.Region), middleware.Before); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecursionDetection(stack); 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
|
||||
}
|
||||
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func newServiceMetadataMiddleware_opAnalyzeDocument(region string) *awsmiddleware.RegisterServiceMetadata {
|
||||
return &awsmiddleware.RegisterServiceMetadata{
|
||||
Region: region,
|
||||
ServiceID: ServiceID,
|
||||
OperationName: "AnalyzeDocument",
|
||||
}
|
||||
}
|
||||
+192
@@ -0,0 +1,192 @@
|
||||
// Code generated by smithy-go-codegen DO NOT EDIT.
|
||||
|
||||
package textract
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
|
||||
"github.com/aws/aws-sdk-go-v2/service/textract/types"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
)
|
||||
|
||||
// AnalyzeExpense synchronously analyzes an input document for financially related
|
||||
// relationships between text.
|
||||
//
|
||||
// Information is returned as ExpenseDocuments and seperated as follows:
|
||||
//
|
||||
// - LineItemGroups - A data set containing LineItems which store information
|
||||
// about the lines of text, such as an item purchased and its price on a receipt.
|
||||
//
|
||||
// - SummaryFields - Contains all other information a receipt, such as header
|
||||
// information or the vendors name.
|
||||
func (c *Client) AnalyzeExpense(ctx context.Context, params *AnalyzeExpenseInput, optFns ...func(*Options)) (*AnalyzeExpenseOutput, error) {
|
||||
if params == nil {
|
||||
params = &AnalyzeExpenseInput{}
|
||||
}
|
||||
|
||||
result, metadata, err := c.invokeOperation(ctx, "AnalyzeExpense", params, optFns, c.addOperationAnalyzeExpenseMiddlewares)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out := result.(*AnalyzeExpenseOutput)
|
||||
out.ResultMetadata = metadata
|
||||
return out, nil
|
||||
}
|
||||
|
||||
type AnalyzeExpenseInput struct {
|
||||
|
||||
// The input document, either as bytes or as an S3 object.
|
||||
//
|
||||
// You pass image bytes to an Amazon Textract API operation by using the Bytes
|
||||
// property. For example, you would use the Bytes property to pass a document
|
||||
// loaded from a local file system. Image bytes passed by using the Bytes property
|
||||
// must be base64 encoded. Your code might not need to encode document file bytes
|
||||
// if you're using an AWS SDK to call Amazon Textract API operations.
|
||||
//
|
||||
// You pass images stored in an S3 bucket to an Amazon Textract API operation by
|
||||
// using the S3Object property. Documents stored in an S3 bucket don't need to be
|
||||
// base64 encoded.
|
||||
//
|
||||
// The AWS Region for the S3 bucket that contains the S3 object must match the AWS
|
||||
// Region that you use for Amazon Textract operations.
|
||||
//
|
||||
// If you use the AWS CLI to call Amazon Textract operations, passing image bytes
|
||||
// using the Bytes property isn't supported. You must first upload the document to
|
||||
// an Amazon S3 bucket, and then call the operation using the S3Object property.
|
||||
//
|
||||
// For Amazon Textract to process an S3 object, the user must have permission to
|
||||
// access the S3 object.
|
||||
//
|
||||
// This member is required.
|
||||
Document *types.Document
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
type AnalyzeExpenseOutput struct {
|
||||
|
||||
// Information about the input document.
|
||||
DocumentMetadata *types.DocumentMetadata
|
||||
|
||||
// The expenses detected by Amazon Textract.
|
||||
ExpenseDocuments []types.ExpenseDocument
|
||||
|
||||
// Metadata pertaining to the operation's result.
|
||||
ResultMetadata middleware.Metadata
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (c *Client) addOperationAnalyzeExpenseMiddlewares(stack *middleware.Stack, options Options) (err error) {
|
||||
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Serialize.Add(&awsAwsjson11_serializeOpAnalyzeExpense{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpAnalyzeExpense{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := addProtocolFinalizerMiddlewares(stack, options, "AnalyzeExpense"); err != nil {
|
||||
return fmt.Errorf("add protocol finalizers: %v", err)
|
||||
}
|
||||
|
||||
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLoggerMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientRequestID(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputeContentLength(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addResolveEndpointMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputePayloadSHA256(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRetry(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRawResponseToMetadata(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecordResponseTiming(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanRetryLoop(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientUserAgent(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addTimeOffsetBuild(stack, c); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addUserAgentRetryMode(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addCredentialSource(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addOpAnalyzeExpenseValidationMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAnalyzeExpense(options.Region), middleware.Before); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecursionDetection(stack); 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
|
||||
}
|
||||
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func newServiceMetadataMiddleware_opAnalyzeExpense(region string) *awsmiddleware.RegisterServiceMetadata {
|
||||
return &awsmiddleware.RegisterServiceMetadata{
|
||||
Region: region,
|
||||
ServiceID: ServiceID,
|
||||
OperationName: "AnalyzeExpense",
|
||||
}
|
||||
}
|
||||
+170
@@ -0,0 +1,170 @@
|
||||
// Code generated by smithy-go-codegen DO NOT EDIT.
|
||||
|
||||
package textract
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
|
||||
"github.com/aws/aws-sdk-go-v2/service/textract/types"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
)
|
||||
|
||||
// Analyzes identity documents for relevant information. This information is
|
||||
// extracted and returned as IdentityDocumentFields , which records both the
|
||||
// normalized field and value of the extracted text. Unlike other Amazon Textract
|
||||
// operations, AnalyzeID doesn't return any Geometry data.
|
||||
func (c *Client) AnalyzeID(ctx context.Context, params *AnalyzeIDInput, optFns ...func(*Options)) (*AnalyzeIDOutput, error) {
|
||||
if params == nil {
|
||||
params = &AnalyzeIDInput{}
|
||||
}
|
||||
|
||||
result, metadata, err := c.invokeOperation(ctx, "AnalyzeID", params, optFns, c.addOperationAnalyzeIDMiddlewares)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out := result.(*AnalyzeIDOutput)
|
||||
out.ResultMetadata = metadata
|
||||
return out, nil
|
||||
}
|
||||
|
||||
type AnalyzeIDInput struct {
|
||||
|
||||
// The document being passed to AnalyzeID.
|
||||
//
|
||||
// This member is required.
|
||||
DocumentPages []types.Document
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
type AnalyzeIDOutput struct {
|
||||
|
||||
// The version of the AnalyzeIdentity API being used to process documents.
|
||||
AnalyzeIDModelVersion *string
|
||||
|
||||
// Information about the input document.
|
||||
DocumentMetadata *types.DocumentMetadata
|
||||
|
||||
// The list of documents processed by AnalyzeID. Includes a number denoting their
|
||||
// place in the list and the response structure for the document.
|
||||
IdentityDocuments []types.IdentityDocument
|
||||
|
||||
// Metadata pertaining to the operation's result.
|
||||
ResultMetadata middleware.Metadata
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (c *Client) addOperationAnalyzeIDMiddlewares(stack *middleware.Stack, options Options) (err error) {
|
||||
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Serialize.Add(&awsAwsjson11_serializeOpAnalyzeID{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpAnalyzeID{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := addProtocolFinalizerMiddlewares(stack, options, "AnalyzeID"); err != nil {
|
||||
return fmt.Errorf("add protocol finalizers: %v", err)
|
||||
}
|
||||
|
||||
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLoggerMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientRequestID(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputeContentLength(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addResolveEndpointMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputePayloadSHA256(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRetry(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRawResponseToMetadata(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecordResponseTiming(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanRetryLoop(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientUserAgent(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addTimeOffsetBuild(stack, c); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addUserAgentRetryMode(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addCredentialSource(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addOpAnalyzeIDValidationMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAnalyzeID(options.Region), middleware.Before); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecursionDetection(stack); 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
|
||||
}
|
||||
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func newServiceMetadataMiddleware_opAnalyzeID(region string) *awsmiddleware.RegisterServiceMetadata {
|
||||
return &awsmiddleware.RegisterServiceMetadata{
|
||||
Region: region,
|
||||
ServiceID: ServiceID,
|
||||
OperationName: "AnalyzeID",
|
||||
}
|
||||
}
|
||||
+221
@@ -0,0 +1,221 @@
|
||||
// Code generated by smithy-go-codegen DO NOT EDIT.
|
||||
|
||||
package textract
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
|
||||
"github.com/aws/aws-sdk-go-v2/service/textract/types"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
)
|
||||
|
||||
// Creates an adapter, which can be fine-tuned for enhanced performance on user
|
||||
// provided documents. Takes an AdapterName and FeatureType. Currently the only
|
||||
// supported feature type is QUERIES . You can also provide a Description, Tags,
|
||||
// and a ClientRequestToken. You can choose whether or not the adapter should be
|
||||
// AutoUpdated with the AutoUpdate argument. By default, AutoUpdate is set to
|
||||
// DISABLED.
|
||||
func (c *Client) CreateAdapter(ctx context.Context, params *CreateAdapterInput, optFns ...func(*Options)) (*CreateAdapterOutput, error) {
|
||||
if params == nil {
|
||||
params = &CreateAdapterInput{}
|
||||
}
|
||||
|
||||
result, metadata, err := c.invokeOperation(ctx, "CreateAdapter", params, optFns, c.addOperationCreateAdapterMiddlewares)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out := result.(*CreateAdapterOutput)
|
||||
out.ResultMetadata = metadata
|
||||
return out, nil
|
||||
}
|
||||
|
||||
type CreateAdapterInput struct {
|
||||
|
||||
// The name to be assigned to the adapter being created.
|
||||
//
|
||||
// This member is required.
|
||||
AdapterName *string
|
||||
|
||||
// The type of feature that the adapter is being trained on. Currrenly, supported
|
||||
// feature types are: QUERIES
|
||||
//
|
||||
// This member is required.
|
||||
FeatureTypes []types.FeatureType
|
||||
|
||||
// Controls whether or not the adapter should automatically update.
|
||||
AutoUpdate types.AutoUpdate
|
||||
|
||||
// Idempotent token is used to recognize the request. If the same token is used
|
||||
// with multiple CreateAdapter requests, the same session is returned. This token
|
||||
// is employed to avoid unintentionally creating the same session multiple times.
|
||||
ClientRequestToken *string
|
||||
|
||||
// The description to be assigned to the adapter being created.
|
||||
Description *string
|
||||
|
||||
// A list of tags to be added to the adapter.
|
||||
Tags map[string]string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
type CreateAdapterOutput struct {
|
||||
|
||||
// A string containing the unique ID for the adapter that has been created.
|
||||
AdapterId *string
|
||||
|
||||
// Metadata pertaining to the operation's result.
|
||||
ResultMetadata middleware.Metadata
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (c *Client) addOperationCreateAdapterMiddlewares(stack *middleware.Stack, options Options) (err error) {
|
||||
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateAdapter{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateAdapter{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := addProtocolFinalizerMiddlewares(stack, options, "CreateAdapter"); err != nil {
|
||||
return fmt.Errorf("add protocol finalizers: %v", err)
|
||||
}
|
||||
|
||||
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLoggerMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientRequestID(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputeContentLength(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addResolveEndpointMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputePayloadSHA256(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRetry(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRawResponseToMetadata(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecordResponseTiming(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanRetryLoop(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientUserAgent(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addTimeOffsetBuild(stack, c); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addUserAgentRetryMode(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addCredentialSource(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addIdempotencyToken_opCreateAdapterMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addOpCreateAdapterValidationMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateAdapter(options.Region), middleware.Before); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecursionDetection(stack); 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
|
||||
}
|
||||
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type idempotencyToken_initializeOpCreateAdapter struct {
|
||||
tokenProvider IdempotencyTokenProvider
|
||||
}
|
||||
|
||||
func (*idempotencyToken_initializeOpCreateAdapter) ID() string {
|
||||
return "OperationIdempotencyTokenAutoFill"
|
||||
}
|
||||
|
||||
func (m *idempotencyToken_initializeOpCreateAdapter) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
|
||||
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
|
||||
) {
|
||||
if m.tokenProvider == nil {
|
||||
return next.HandleInitialize(ctx, in)
|
||||
}
|
||||
|
||||
input, ok := in.Parameters.(*CreateAdapterInput)
|
||||
if !ok {
|
||||
return out, metadata, fmt.Errorf("expected middleware input to be of type *CreateAdapterInput ")
|
||||
}
|
||||
|
||||
if input.ClientRequestToken == nil {
|
||||
t, err := m.tokenProvider.GetIdempotencyToken()
|
||||
if err != nil {
|
||||
return out, metadata, err
|
||||
}
|
||||
input.ClientRequestToken = &t
|
||||
}
|
||||
return next.HandleInitialize(ctx, in)
|
||||
}
|
||||
func addIdempotencyToken_opCreateAdapterMiddleware(stack *middleware.Stack, cfg Options) error {
|
||||
return stack.Initialize.Add(&idempotencyToken_initializeOpCreateAdapter{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before)
|
||||
}
|
||||
|
||||
func newServiceMetadataMiddleware_opCreateAdapter(region string) *awsmiddleware.RegisterServiceMetadata {
|
||||
return &awsmiddleware.RegisterServiceMetadata{
|
||||
Region: region,
|
||||
ServiceID: ServiceID,
|
||||
OperationName: "CreateAdapter",
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+249
@@ -0,0 +1,249 @@
|
||||
// Code generated by smithy-go-codegen DO NOT EDIT.
|
||||
|
||||
package textract
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
|
||||
"github.com/aws/aws-sdk-go-v2/service/textract/types"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
)
|
||||
|
||||
// Creates a new version of an adapter. Operates on a provided AdapterId and a
|
||||
// specified dataset provided via the DatasetConfig argument. Requires that you
|
||||
// specify an Amazon S3 bucket with the OutputConfig argument. You can provide an
|
||||
// optional KMSKeyId, an optional ClientRequestToken, and optional tags.
|
||||
func (c *Client) CreateAdapterVersion(ctx context.Context, params *CreateAdapterVersionInput, optFns ...func(*Options)) (*CreateAdapterVersionOutput, error) {
|
||||
if params == nil {
|
||||
params = &CreateAdapterVersionInput{}
|
||||
}
|
||||
|
||||
result, metadata, err := c.invokeOperation(ctx, "CreateAdapterVersion", params, optFns, c.addOperationCreateAdapterVersionMiddlewares)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out := result.(*CreateAdapterVersionOutput)
|
||||
out.ResultMetadata = metadata
|
||||
return out, nil
|
||||
}
|
||||
|
||||
type CreateAdapterVersionInput struct {
|
||||
|
||||
// A string containing a unique ID for the adapter that will receive a new version.
|
||||
//
|
||||
// This member is required.
|
||||
AdapterId *string
|
||||
|
||||
// Specifies a dataset used to train a new adapter version. Takes a
|
||||
// ManifestS3Object as the value.
|
||||
//
|
||||
// This member is required.
|
||||
DatasetConfig *types.AdapterVersionDatasetConfig
|
||||
|
||||
// Sets whether or not your output will go to a user created bucket. Used to set
|
||||
// the name of the bucket, and the prefix on the output file.
|
||||
//
|
||||
// OutputConfig is an optional parameter which lets you adjust where your output
|
||||
// will be placed. By default, Amazon Textract will store the results internally
|
||||
// and can only be accessed by the Get API operations. With OutputConfig enabled,
|
||||
// you can set the name of the bucket the output will be sent to the file prefix of
|
||||
// the results where you can download your results. Additionally, you can set the
|
||||
// KMSKeyID parameter to a customer master key (CMK) to encrypt your output.
|
||||
// Without this parameter set Amazon Textract will encrypt server-side using the
|
||||
// AWS managed CMK for Amazon S3.
|
||||
//
|
||||
// Decryption of Customer Content is necessary for processing of the documents by
|
||||
// Amazon Textract. If your account is opted out under an AI services opt out
|
||||
// policy then all unencrypted Customer Content is immediately and permanently
|
||||
// deleted after the Customer Content has been processed by the service. No copy of
|
||||
// of the output is retained by Amazon Textract. For information about how to opt
|
||||
// out, see [Managing AI services opt-out policy.]
|
||||
//
|
||||
// For more information on data privacy, see the [Data Privacy FAQ].
|
||||
//
|
||||
// [Managing AI services opt-out policy.]: https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_ai-opt-out.html
|
||||
// [Data Privacy FAQ]: https://aws.amazon.com/compliance/data-privacy-faq/
|
||||
//
|
||||
// This member is required.
|
||||
OutputConfig *types.OutputConfig
|
||||
|
||||
// Idempotent token is used to recognize the request. If the same token is used
|
||||
// with multiple CreateAdapterVersion requests, the same session is returned. This
|
||||
// token is employed to avoid unintentionally creating the same session multiple
|
||||
// times.
|
||||
ClientRequestToken *string
|
||||
|
||||
// The identifier for your AWS Key Management Service key (AWS KMS key). Used to
|
||||
// encrypt your documents.
|
||||
KMSKeyId *string
|
||||
|
||||
// A set of tags (key-value pairs) that you want to attach to the adapter version.
|
||||
Tags map[string]string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
type CreateAdapterVersionOutput struct {
|
||||
|
||||
// A string containing the unique ID for the adapter that has received a new
|
||||
// version.
|
||||
AdapterId *string
|
||||
|
||||
// A string describing the new version of the adapter.
|
||||
AdapterVersion *string
|
||||
|
||||
// Metadata pertaining to the operation's result.
|
||||
ResultMetadata middleware.Metadata
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (c *Client) addOperationCreateAdapterVersionMiddlewares(stack *middleware.Stack, options Options) (err error) {
|
||||
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateAdapterVersion{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateAdapterVersion{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := addProtocolFinalizerMiddlewares(stack, options, "CreateAdapterVersion"); err != nil {
|
||||
return fmt.Errorf("add protocol finalizers: %v", err)
|
||||
}
|
||||
|
||||
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLoggerMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientRequestID(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputeContentLength(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addResolveEndpointMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputePayloadSHA256(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRetry(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRawResponseToMetadata(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecordResponseTiming(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanRetryLoop(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientUserAgent(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addTimeOffsetBuild(stack, c); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addUserAgentRetryMode(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addCredentialSource(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addIdempotencyToken_opCreateAdapterVersionMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addOpCreateAdapterVersionValidationMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateAdapterVersion(options.Region), middleware.Before); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecursionDetection(stack); 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
|
||||
}
|
||||
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type idempotencyToken_initializeOpCreateAdapterVersion struct {
|
||||
tokenProvider IdempotencyTokenProvider
|
||||
}
|
||||
|
||||
func (*idempotencyToken_initializeOpCreateAdapterVersion) ID() string {
|
||||
return "OperationIdempotencyTokenAutoFill"
|
||||
}
|
||||
|
||||
func (m *idempotencyToken_initializeOpCreateAdapterVersion) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
|
||||
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
|
||||
) {
|
||||
if m.tokenProvider == nil {
|
||||
return next.HandleInitialize(ctx, in)
|
||||
}
|
||||
|
||||
input, ok := in.Parameters.(*CreateAdapterVersionInput)
|
||||
if !ok {
|
||||
return out, metadata, fmt.Errorf("expected middleware input to be of type *CreateAdapterVersionInput ")
|
||||
}
|
||||
|
||||
if input.ClientRequestToken == nil {
|
||||
t, err := m.tokenProvider.GetIdempotencyToken()
|
||||
if err != nil {
|
||||
return out, metadata, err
|
||||
}
|
||||
input.ClientRequestToken = &t
|
||||
}
|
||||
return next.HandleInitialize(ctx, in)
|
||||
}
|
||||
func addIdempotencyToken_opCreateAdapterVersionMiddleware(stack *middleware.Stack, cfg Options) error {
|
||||
return stack.Initialize.Add(&idempotencyToken_initializeOpCreateAdapterVersion{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before)
|
||||
}
|
||||
|
||||
func newServiceMetadataMiddleware_opCreateAdapterVersion(region string) *awsmiddleware.RegisterServiceMetadata {
|
||||
return &awsmiddleware.RegisterServiceMetadata{
|
||||
Region: region,
|
||||
ServiceID: ServiceID,
|
||||
OperationName: "CreateAdapterVersion",
|
||||
}
|
||||
}
|
||||
+156
@@ -0,0 +1,156 @@
|
||||
// Code generated by smithy-go-codegen DO NOT EDIT.
|
||||
|
||||
package textract
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
)
|
||||
|
||||
// Deletes an Amazon Textract adapter. Takes an AdapterId and deletes the adapter
|
||||
// specified by the ID.
|
||||
func (c *Client) DeleteAdapter(ctx context.Context, params *DeleteAdapterInput, optFns ...func(*Options)) (*DeleteAdapterOutput, error) {
|
||||
if params == nil {
|
||||
params = &DeleteAdapterInput{}
|
||||
}
|
||||
|
||||
result, metadata, err := c.invokeOperation(ctx, "DeleteAdapter", params, optFns, c.addOperationDeleteAdapterMiddlewares)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out := result.(*DeleteAdapterOutput)
|
||||
out.ResultMetadata = metadata
|
||||
return out, nil
|
||||
}
|
||||
|
||||
type DeleteAdapterInput struct {
|
||||
|
||||
// A string containing a unique ID for the adapter to be deleted.
|
||||
//
|
||||
// This member is required.
|
||||
AdapterId *string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
type DeleteAdapterOutput struct {
|
||||
// Metadata pertaining to the operation's result.
|
||||
ResultMetadata middleware.Metadata
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (c *Client) addOperationDeleteAdapterMiddlewares(stack *middleware.Stack, options Options) (err error) {
|
||||
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDeleteAdapter{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDeleteAdapter{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteAdapter"); err != nil {
|
||||
return fmt.Errorf("add protocol finalizers: %v", err)
|
||||
}
|
||||
|
||||
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLoggerMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientRequestID(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputeContentLength(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addResolveEndpointMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputePayloadSHA256(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRetry(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRawResponseToMetadata(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecordResponseTiming(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanRetryLoop(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientUserAgent(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addTimeOffsetBuild(stack, c); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addUserAgentRetryMode(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addCredentialSource(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addOpDeleteAdapterValidationMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteAdapter(options.Region), middleware.Before); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecursionDetection(stack); 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
|
||||
}
|
||||
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func newServiceMetadataMiddleware_opDeleteAdapter(region string) *awsmiddleware.RegisterServiceMetadata {
|
||||
return &awsmiddleware.RegisterServiceMetadata{
|
||||
Region: region,
|
||||
ServiceID: ServiceID,
|
||||
OperationName: "DeleteAdapter",
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+162
@@ -0,0 +1,162 @@
|
||||
// Code generated by smithy-go-codegen DO NOT EDIT.
|
||||
|
||||
package textract
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
)
|
||||
|
||||
// Deletes an Amazon Textract adapter version. Requires that you specify both an
|
||||
// AdapterId and a AdapterVersion. Deletes the adapter version specified by the
|
||||
// AdapterId and the AdapterVersion.
|
||||
func (c *Client) DeleteAdapterVersion(ctx context.Context, params *DeleteAdapterVersionInput, optFns ...func(*Options)) (*DeleteAdapterVersionOutput, error) {
|
||||
if params == nil {
|
||||
params = &DeleteAdapterVersionInput{}
|
||||
}
|
||||
|
||||
result, metadata, err := c.invokeOperation(ctx, "DeleteAdapterVersion", params, optFns, c.addOperationDeleteAdapterVersionMiddlewares)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out := result.(*DeleteAdapterVersionOutput)
|
||||
out.ResultMetadata = metadata
|
||||
return out, nil
|
||||
}
|
||||
|
||||
type DeleteAdapterVersionInput struct {
|
||||
|
||||
// A string containing a unique ID for the adapter version that will be deleted.
|
||||
//
|
||||
// This member is required.
|
||||
AdapterId *string
|
||||
|
||||
// Specifies the adapter version to be deleted.
|
||||
//
|
||||
// This member is required.
|
||||
AdapterVersion *string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
type DeleteAdapterVersionOutput struct {
|
||||
// Metadata pertaining to the operation's result.
|
||||
ResultMetadata middleware.Metadata
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (c *Client) addOperationDeleteAdapterVersionMiddlewares(stack *middleware.Stack, options Options) (err error) {
|
||||
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDeleteAdapterVersion{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDeleteAdapterVersion{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteAdapterVersion"); err != nil {
|
||||
return fmt.Errorf("add protocol finalizers: %v", err)
|
||||
}
|
||||
|
||||
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLoggerMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientRequestID(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputeContentLength(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addResolveEndpointMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputePayloadSHA256(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRetry(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRawResponseToMetadata(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecordResponseTiming(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanRetryLoop(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientUserAgent(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addTimeOffsetBuild(stack, c); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addUserAgentRetryMode(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addCredentialSource(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addOpDeleteAdapterVersionValidationMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteAdapterVersion(options.Region), middleware.Before); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecursionDetection(stack); 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
|
||||
}
|
||||
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func newServiceMetadataMiddleware_opDeleteAdapterVersion(region string) *awsmiddleware.RegisterServiceMetadata {
|
||||
return &awsmiddleware.RegisterServiceMetadata{
|
||||
Region: region,
|
||||
ServiceID: ServiceID,
|
||||
OperationName: "DeleteAdapterVersion",
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+187
@@ -0,0 +1,187 @@
|
||||
// Code generated by smithy-go-codegen DO NOT EDIT.
|
||||
|
||||
package textract
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
|
||||
"github.com/aws/aws-sdk-go-v2/service/textract/types"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
)
|
||||
|
||||
// Detects text in the input document. Amazon Textract can detect lines of text
|
||||
// and the words that make up a line of text. The input document must be in one of
|
||||
// the following image formats: JPEG, PNG, PDF, or TIFF. DetectDocumentText
|
||||
// returns the detected text in an array of Blockobjects.
|
||||
//
|
||||
// Each document page has as an associated Block of type PAGE. Each PAGE Block
|
||||
// object is the parent of LINE Block objects that represent the lines of detected
|
||||
// text on a page. A LINE Block object is a parent for each word that makes up the
|
||||
// line. Words are represented by Block objects of type WORD.
|
||||
//
|
||||
// DetectDocumentText is a synchronous operation. To analyze documents
|
||||
// asynchronously, use StartDocumentTextDetection.
|
||||
//
|
||||
// For more information, see [Document Text Detection].
|
||||
//
|
||||
// [Document Text Detection]: https://docs.aws.amazon.com/textract/latest/dg/how-it-works-detecting.html
|
||||
func (c *Client) DetectDocumentText(ctx context.Context, params *DetectDocumentTextInput, optFns ...func(*Options)) (*DetectDocumentTextOutput, error) {
|
||||
if params == nil {
|
||||
params = &DetectDocumentTextInput{}
|
||||
}
|
||||
|
||||
result, metadata, err := c.invokeOperation(ctx, "DetectDocumentText", params, optFns, c.addOperationDetectDocumentTextMiddlewares)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out := result.(*DetectDocumentTextOutput)
|
||||
out.ResultMetadata = metadata
|
||||
return out, nil
|
||||
}
|
||||
|
||||
type DetectDocumentTextInput struct {
|
||||
|
||||
// The input document as base64-encoded bytes or an Amazon S3 object. If you use
|
||||
// the AWS CLI to call Amazon Textract operations, you can't pass image bytes. The
|
||||
// document must be an image in JPEG or PNG format.
|
||||
//
|
||||
// If you're using an AWS SDK to call Amazon Textract, you might not need to
|
||||
// base64-encode image bytes that are passed using the Bytes field.
|
||||
//
|
||||
// This member is required.
|
||||
Document *types.Document
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
type DetectDocumentTextOutput struct {
|
||||
|
||||
// An array of Block objects that contain the text that's detected in the document.
|
||||
Blocks []types.Block
|
||||
|
||||
//
|
||||
DetectDocumentTextModelVersion *string
|
||||
|
||||
// Metadata about the document. It contains the number of pages that are detected
|
||||
// in the document.
|
||||
DocumentMetadata *types.DocumentMetadata
|
||||
|
||||
// Metadata pertaining to the operation's result.
|
||||
ResultMetadata middleware.Metadata
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (c *Client) addOperationDetectDocumentTextMiddlewares(stack *middleware.Stack, options Options) (err error) {
|
||||
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDetectDocumentText{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDetectDocumentText{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := addProtocolFinalizerMiddlewares(stack, options, "DetectDocumentText"); err != nil {
|
||||
return fmt.Errorf("add protocol finalizers: %v", err)
|
||||
}
|
||||
|
||||
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLoggerMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientRequestID(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputeContentLength(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addResolveEndpointMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputePayloadSHA256(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRetry(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRawResponseToMetadata(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecordResponseTiming(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanRetryLoop(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientUserAgent(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addTimeOffsetBuild(stack, c); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addUserAgentRetryMode(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addCredentialSource(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addOpDetectDocumentTextValidationMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDetectDocumentText(options.Region), middleware.Before); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecursionDetection(stack); 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
|
||||
}
|
||||
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func newServiceMetadataMiddleware_opDetectDocumentText(region string) *awsmiddleware.RegisterServiceMetadata {
|
||||
return &awsmiddleware.RegisterServiceMetadata{
|
||||
Region: region,
|
||||
ServiceID: ServiceID,
|
||||
OperationName: "DetectDocumentText",
|
||||
}
|
||||
}
|
||||
+182
@@ -0,0 +1,182 @@
|
||||
// Code generated by smithy-go-codegen DO NOT EDIT.
|
||||
|
||||
package textract
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
|
||||
"github.com/aws/aws-sdk-go-v2/service/textract/types"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Gets configuration information for an adapter specified by an AdapterId,
|
||||
// returning information on AdapterName, Description, CreationTime, AutoUpdate
|
||||
// status, and FeatureTypes.
|
||||
func (c *Client) GetAdapter(ctx context.Context, params *GetAdapterInput, optFns ...func(*Options)) (*GetAdapterOutput, error) {
|
||||
if params == nil {
|
||||
params = &GetAdapterInput{}
|
||||
}
|
||||
|
||||
result, metadata, err := c.invokeOperation(ctx, "GetAdapter", params, optFns, c.addOperationGetAdapterMiddlewares)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out := result.(*GetAdapterOutput)
|
||||
out.ResultMetadata = metadata
|
||||
return out, nil
|
||||
}
|
||||
|
||||
type GetAdapterInput struct {
|
||||
|
||||
// A string containing a unique ID for the adapter.
|
||||
//
|
||||
// This member is required.
|
||||
AdapterId *string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
type GetAdapterOutput struct {
|
||||
|
||||
// A string identifying the adapter that information has been retrieved for.
|
||||
AdapterId *string
|
||||
|
||||
// The name of the requested adapter.
|
||||
AdapterName *string
|
||||
|
||||
// Binary value indicating if the adapter is being automatically updated or not.
|
||||
AutoUpdate types.AutoUpdate
|
||||
|
||||
// The date and time the requested adapter was created at.
|
||||
CreationTime *time.Time
|
||||
|
||||
// The description for the requested adapter.
|
||||
Description *string
|
||||
|
||||
// List of the targeted feature types for the requested adapter.
|
||||
FeatureTypes []types.FeatureType
|
||||
|
||||
// A set of tags (key-value pairs) associated with the adapter that has been
|
||||
// retrieved.
|
||||
Tags map[string]string
|
||||
|
||||
// Metadata pertaining to the operation's result.
|
||||
ResultMetadata middleware.Metadata
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (c *Client) addOperationGetAdapterMiddlewares(stack *middleware.Stack, options Options) (err error) {
|
||||
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetAdapter{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetAdapter{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := addProtocolFinalizerMiddlewares(stack, options, "GetAdapter"); err != nil {
|
||||
return fmt.Errorf("add protocol finalizers: %v", err)
|
||||
}
|
||||
|
||||
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLoggerMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientRequestID(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputeContentLength(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addResolveEndpointMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputePayloadSHA256(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRetry(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRawResponseToMetadata(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecordResponseTiming(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanRetryLoop(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientUserAgent(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addTimeOffsetBuild(stack, c); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addUserAgentRetryMode(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addCredentialSource(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addOpGetAdapterValidationMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetAdapter(options.Region), middleware.Before); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecursionDetection(stack); 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
|
||||
}
|
||||
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func newServiceMetadataMiddleware_opGetAdapter(region string) *awsmiddleware.RegisterServiceMetadata {
|
||||
return &awsmiddleware.RegisterServiceMetadata{
|
||||
Region: region,
|
||||
ServiceID: ServiceID,
|
||||
OperationName: "GetAdapter",
|
||||
}
|
||||
}
|
||||
+224
@@ -0,0 +1,224 @@
|
||||
// Code generated by smithy-go-codegen DO NOT EDIT.
|
||||
|
||||
package textract
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
|
||||
"github.com/aws/aws-sdk-go-v2/service/textract/types"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Gets configuration information for the specified adapter version, including:
|
||||
// AdapterId, AdapterVersion, FeatureTypes, Status, StatusMessage, DatasetConfig,
|
||||
// KMSKeyId, OutputConfig, Tags and EvaluationMetrics.
|
||||
func (c *Client) GetAdapterVersion(ctx context.Context, params *GetAdapterVersionInput, optFns ...func(*Options)) (*GetAdapterVersionOutput, error) {
|
||||
if params == nil {
|
||||
params = &GetAdapterVersionInput{}
|
||||
}
|
||||
|
||||
result, metadata, err := c.invokeOperation(ctx, "GetAdapterVersion", params, optFns, c.addOperationGetAdapterVersionMiddlewares)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out := result.(*GetAdapterVersionOutput)
|
||||
out.ResultMetadata = metadata
|
||||
return out, nil
|
||||
}
|
||||
|
||||
type GetAdapterVersionInput struct {
|
||||
|
||||
// A string specifying a unique ID for the adapter version you want to retrieve
|
||||
// information for.
|
||||
//
|
||||
// This member is required.
|
||||
AdapterId *string
|
||||
|
||||
// A string specifying the adapter version you want to retrieve information for.
|
||||
//
|
||||
// This member is required.
|
||||
AdapterVersion *string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
type GetAdapterVersionOutput struct {
|
||||
|
||||
// A string containing a unique ID for the adapter version being retrieved.
|
||||
AdapterId *string
|
||||
|
||||
// A string containing the adapter version that has been retrieved.
|
||||
AdapterVersion *string
|
||||
|
||||
// The time that the adapter version was created.
|
||||
CreationTime *time.Time
|
||||
|
||||
// Specifies a dataset used to train a new adapter version. Takes a
|
||||
// ManifestS3Objec as the value.
|
||||
DatasetConfig *types.AdapterVersionDatasetConfig
|
||||
|
||||
// The evaluation metrics (F1 score, Precision, and Recall) for the requested
|
||||
// version, grouped by baseline metrics and adapter version.
|
||||
EvaluationMetrics []types.AdapterVersionEvaluationMetric
|
||||
|
||||
// List of the targeted feature types for the requested adapter version.
|
||||
FeatureTypes []types.FeatureType
|
||||
|
||||
// The identifier for your AWS Key Management Service key (AWS KMS key). Used to
|
||||
// encrypt your documents.
|
||||
KMSKeyId *string
|
||||
|
||||
// Sets whether or not your output will go to a user created bucket. Used to set
|
||||
// the name of the bucket, and the prefix on the output file.
|
||||
//
|
||||
// OutputConfig is an optional parameter which lets you adjust where your output
|
||||
// will be placed. By default, Amazon Textract will store the results internally
|
||||
// and can only be accessed by the Get API operations. With OutputConfig enabled,
|
||||
// you can set the name of the bucket the output will be sent to the file prefix of
|
||||
// the results where you can download your results. Additionally, you can set the
|
||||
// KMSKeyID parameter to a customer master key (CMK) to encrypt your output.
|
||||
// Without this parameter set Amazon Textract will encrypt server-side using the
|
||||
// AWS managed CMK for Amazon S3.
|
||||
//
|
||||
// Decryption of Customer Content is necessary for processing of the documents by
|
||||
// Amazon Textract. If your account is opted out under an AI services opt out
|
||||
// policy then all unencrypted Customer Content is immediately and permanently
|
||||
// deleted after the Customer Content has been processed by the service. No copy of
|
||||
// of the output is retained by Amazon Textract. For information about how to opt
|
||||
// out, see [Managing AI services opt-out policy.]
|
||||
//
|
||||
// For more information on data privacy, see the [Data Privacy FAQ].
|
||||
//
|
||||
// [Managing AI services opt-out policy.]: https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_ai-opt-out.html
|
||||
// [Data Privacy FAQ]: https://aws.amazon.com/compliance/data-privacy-faq/
|
||||
OutputConfig *types.OutputConfig
|
||||
|
||||
// The status of the adapter version that has been requested.
|
||||
Status types.AdapterVersionStatus
|
||||
|
||||
// A message that describes the status of the requested adapter version.
|
||||
StatusMessage *string
|
||||
|
||||
// A set of tags (key-value pairs) that are associated with the adapter version.
|
||||
Tags map[string]string
|
||||
|
||||
// Metadata pertaining to the operation's result.
|
||||
ResultMetadata middleware.Metadata
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (c *Client) addOperationGetAdapterVersionMiddlewares(stack *middleware.Stack, options Options) (err error) {
|
||||
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetAdapterVersion{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetAdapterVersion{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := addProtocolFinalizerMiddlewares(stack, options, "GetAdapterVersion"); err != nil {
|
||||
return fmt.Errorf("add protocol finalizers: %v", err)
|
||||
}
|
||||
|
||||
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLoggerMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientRequestID(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputeContentLength(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addResolveEndpointMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputePayloadSHA256(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRetry(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRawResponseToMetadata(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecordResponseTiming(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanRetryLoop(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientUserAgent(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addTimeOffsetBuild(stack, c); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addUserAgentRetryMode(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addCredentialSource(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addOpGetAdapterVersionValidationMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetAdapterVersion(options.Region), middleware.Before); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecursionDetection(stack); 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
|
||||
}
|
||||
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func newServiceMetadataMiddleware_opGetAdapterVersion(region string) *awsmiddleware.RegisterServiceMetadata {
|
||||
return &awsmiddleware.RegisterServiceMetadata{
|
||||
Region: region,
|
||||
ServiceID: ServiceID,
|
||||
OperationName: "GetAdapterVersion",
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+247
@@ -0,0 +1,247 @@
|
||||
// Code generated by smithy-go-codegen DO NOT EDIT.
|
||||
|
||||
package textract
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
|
||||
"github.com/aws/aws-sdk-go-v2/service/textract/types"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
)
|
||||
|
||||
// Gets the results for an Amazon Textract asynchronous operation that analyzes
|
||||
// text in a document.
|
||||
//
|
||||
// You start asynchronous text analysis by calling StartDocumentAnalysis, which returns a job
|
||||
// identifier ( JobId ). When the text analysis operation finishes, Amazon Textract
|
||||
// publishes a completion status to the Amazon Simple Notification Service (Amazon
|
||||
// SNS) topic that's registered in the initial call to StartDocumentAnalysis . To
|
||||
// get the results of the text-detection operation, first check that the status
|
||||
// value published to the Amazon SNS topic is SUCCEEDED . If so, call
|
||||
// GetDocumentAnalysis , and pass the job identifier ( JobId ) from the initial
|
||||
// call to StartDocumentAnalysis .
|
||||
//
|
||||
// GetDocumentAnalysis returns an array of Block objects. The following types of
|
||||
// information are returned:
|
||||
//
|
||||
// - Form data (key-value pairs). The related information is returned in two Block
|
||||
// objects, each of type KEY_VALUE_SET : a KEY Block object and a VALUE Block
|
||||
// object. For example, Name: Ana Silva Carolina contains a key and value. Name: is
|
||||
// the key. Ana Silva Carolina is the value.
|
||||
//
|
||||
// - Table and table cell data. A TABLE Block object contains information about a
|
||||
// detected table. A CELL Block object is returned for each cell in a table.
|
||||
//
|
||||
// - Lines and words of text. A LINE Block object contains one or more WORD Block
|
||||
// objects. All lines and words that are detected in the document are returned
|
||||
// (including text that doesn't have a relationship with the value of the
|
||||
// StartDocumentAnalysis FeatureTypes input parameter).
|
||||
//
|
||||
// - Query. A QUERY Block object contains the query text, alias and link to the
|
||||
// associated Query results block object.
|
||||
//
|
||||
// - Query Results. A QUERY_RESULT Block object contains the answer to the query
|
||||
// and an ID that connects it to the query asked. This Block also contains a
|
||||
// confidence score.
|
||||
//
|
||||
// While processing a document with queries, look out for
|
||||
// INVALID_REQUEST_PARAMETERS output. This indicates that either the per page query
|
||||
// limit has been exceeded or that the operation is trying to query a page in the
|
||||
// document which doesn’t exist.
|
||||
//
|
||||
// Selection elements such as check boxes and option buttons (radio buttons) can
|
||||
// be detected in form data and in tables. A SELECTION_ELEMENT Block object
|
||||
// contains information about a selection element, including the selection status.
|
||||
//
|
||||
// Use the MaxResults parameter to limit the number of blocks that are returned.
|
||||
// If there are more results than specified in MaxResults , the value of NextToken
|
||||
// in the operation response contains a pagination token for getting the next set
|
||||
// of results. To get the next page of results, call GetDocumentAnalysis , and
|
||||
// populate the NextToken request parameter with the token value that's returned
|
||||
// from the previous call to GetDocumentAnalysis .
|
||||
//
|
||||
// For more information, see [Document Text Analysis].
|
||||
//
|
||||
// [Document Text Analysis]: https://docs.aws.amazon.com/textract/latest/dg/how-it-works-analyzing.html
|
||||
func (c *Client) GetDocumentAnalysis(ctx context.Context, params *GetDocumentAnalysisInput, optFns ...func(*Options)) (*GetDocumentAnalysisOutput, error) {
|
||||
if params == nil {
|
||||
params = &GetDocumentAnalysisInput{}
|
||||
}
|
||||
|
||||
result, metadata, err := c.invokeOperation(ctx, "GetDocumentAnalysis", params, optFns, c.addOperationGetDocumentAnalysisMiddlewares)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out := result.(*GetDocumentAnalysisOutput)
|
||||
out.ResultMetadata = metadata
|
||||
return out, nil
|
||||
}
|
||||
|
||||
type GetDocumentAnalysisInput struct {
|
||||
|
||||
// A unique identifier for the text-detection job. The JobId is returned from
|
||||
// StartDocumentAnalysis . A JobId value is only valid for 7 days.
|
||||
//
|
||||
// This member is required.
|
||||
JobId *string
|
||||
|
||||
// The maximum number of results to return per paginated call. The largest value
|
||||
// that you can specify is 1,000. If you specify a value greater than 1,000, a
|
||||
// maximum of 1,000 results is returned. The default value is 1,000.
|
||||
MaxResults *int32
|
||||
|
||||
// If the previous response was incomplete (because there are more blocks to
|
||||
// retrieve), Amazon Textract returns a pagination token in the response. You can
|
||||
// use this pagination token to retrieve the next set of blocks.
|
||||
NextToken *string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
type GetDocumentAnalysisOutput struct {
|
||||
|
||||
//
|
||||
AnalyzeDocumentModelVersion *string
|
||||
|
||||
// The results of the text-analysis operation.
|
||||
Blocks []types.Block
|
||||
|
||||
// Information about a document that Amazon Textract processed. DocumentMetadata
|
||||
// is returned in every page of paginated responses from an Amazon Textract video
|
||||
// operation.
|
||||
DocumentMetadata *types.DocumentMetadata
|
||||
|
||||
// The current status of the text detection job.
|
||||
JobStatus types.JobStatus
|
||||
|
||||
// If the response is truncated, Amazon Textract returns this token. You can use
|
||||
// this token in the subsequent request to retrieve the next set of text detection
|
||||
// results.
|
||||
NextToken *string
|
||||
|
||||
// Returns if the detection job could not be completed. Contains explanation for
|
||||
// what error occured.
|
||||
StatusMessage *string
|
||||
|
||||
// A list of warnings that occurred during the document-analysis operation.
|
||||
Warnings []types.Warning
|
||||
|
||||
// Metadata pertaining to the operation's result.
|
||||
ResultMetadata middleware.Metadata
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (c *Client) addOperationGetDocumentAnalysisMiddlewares(stack *middleware.Stack, options Options) (err error) {
|
||||
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetDocumentAnalysis{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetDocumentAnalysis{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := addProtocolFinalizerMiddlewares(stack, options, "GetDocumentAnalysis"); err != nil {
|
||||
return fmt.Errorf("add protocol finalizers: %v", err)
|
||||
}
|
||||
|
||||
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLoggerMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientRequestID(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputeContentLength(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addResolveEndpointMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputePayloadSHA256(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRetry(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRawResponseToMetadata(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecordResponseTiming(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanRetryLoop(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientUserAgent(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addTimeOffsetBuild(stack, c); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addUserAgentRetryMode(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addCredentialSource(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addOpGetDocumentAnalysisValidationMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetDocumentAnalysis(options.Region), middleware.Before); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecursionDetection(stack); 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
|
||||
}
|
||||
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func newServiceMetadataMiddleware_opGetDocumentAnalysis(region string) *awsmiddleware.RegisterServiceMetadata {
|
||||
return &awsmiddleware.RegisterServiceMetadata{
|
||||
Region: region,
|
||||
ServiceID: ServiceID,
|
||||
OperationName: "GetDocumentAnalysis",
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+224
@@ -0,0 +1,224 @@
|
||||
// Code generated by smithy-go-codegen DO NOT EDIT.
|
||||
|
||||
package textract
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
|
||||
"github.com/aws/aws-sdk-go-v2/service/textract/types"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
)
|
||||
|
||||
// Gets the results for an Amazon Textract asynchronous operation that detects
|
||||
// text in a document. Amazon Textract can detect lines of text and the words that
|
||||
// make up a line of text.
|
||||
//
|
||||
// You start asynchronous text detection by calling StartDocumentTextDetection, which returns a job
|
||||
// identifier ( JobId ). When the text detection operation finishes, Amazon
|
||||
// Textract publishes a completion status to the Amazon Simple Notification Service
|
||||
// (Amazon SNS) topic that's registered in the initial call to
|
||||
// StartDocumentTextDetection . To get the results of the text-detection operation,
|
||||
// first check that the status value published to the Amazon SNS topic is SUCCEEDED
|
||||
// . If so, call GetDocumentTextDetection , and pass the job identifier ( JobId )
|
||||
// from the initial call to StartDocumentTextDetection .
|
||||
//
|
||||
// GetDocumentTextDetection returns an array of Block objects.
|
||||
//
|
||||
// Each document page has as an associated Block of type PAGE. Each PAGE Block
|
||||
// object is the parent of LINE Block objects that represent the lines of detected
|
||||
// text on a page. A LINE Block object is a parent for each word that makes up the
|
||||
// line. Words are represented by Block objects of type WORD.
|
||||
//
|
||||
// Use the MaxResults parameter to limit the number of blocks that are returned.
|
||||
// If there are more results than specified in MaxResults , the value of NextToken
|
||||
// in the operation response contains a pagination token for getting the next set
|
||||
// of results. To get the next page of results, call GetDocumentTextDetection , and
|
||||
// populate the NextToken request parameter with the token value that's returned
|
||||
// from the previous call to GetDocumentTextDetection .
|
||||
//
|
||||
// For more information, see [Document Text Detection].
|
||||
//
|
||||
// [Document Text Detection]: https://docs.aws.amazon.com/textract/latest/dg/how-it-works-detecting.html
|
||||
func (c *Client) GetDocumentTextDetection(ctx context.Context, params *GetDocumentTextDetectionInput, optFns ...func(*Options)) (*GetDocumentTextDetectionOutput, error) {
|
||||
if params == nil {
|
||||
params = &GetDocumentTextDetectionInput{}
|
||||
}
|
||||
|
||||
result, metadata, err := c.invokeOperation(ctx, "GetDocumentTextDetection", params, optFns, c.addOperationGetDocumentTextDetectionMiddlewares)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out := result.(*GetDocumentTextDetectionOutput)
|
||||
out.ResultMetadata = metadata
|
||||
return out, nil
|
||||
}
|
||||
|
||||
type GetDocumentTextDetectionInput struct {
|
||||
|
||||
// A unique identifier for the text detection job. The JobId is returned from
|
||||
// StartDocumentTextDetection . A JobId value is only valid for 7 days.
|
||||
//
|
||||
// This member is required.
|
||||
JobId *string
|
||||
|
||||
// The maximum number of results to return per paginated call. The largest value
|
||||
// you can specify is 1,000. If you specify a value greater than 1,000, a maximum
|
||||
// of 1,000 results is returned. The default value is 1,000.
|
||||
MaxResults *int32
|
||||
|
||||
// If the previous response was incomplete (because there are more blocks to
|
||||
// retrieve), Amazon Textract returns a pagination token in the response. You can
|
||||
// use this pagination token to retrieve the next set of blocks.
|
||||
NextToken *string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
type GetDocumentTextDetectionOutput struct {
|
||||
|
||||
// The results of the text-detection operation.
|
||||
Blocks []types.Block
|
||||
|
||||
//
|
||||
DetectDocumentTextModelVersion *string
|
||||
|
||||
// Information about a document that Amazon Textract processed. DocumentMetadata
|
||||
// is returned in every page of paginated responses from an Amazon Textract video
|
||||
// operation.
|
||||
DocumentMetadata *types.DocumentMetadata
|
||||
|
||||
// The current status of the text detection job.
|
||||
JobStatus types.JobStatus
|
||||
|
||||
// If the response is truncated, Amazon Textract returns this token. You can use
|
||||
// this token in the subsequent request to retrieve the next set of text-detection
|
||||
// results.
|
||||
NextToken *string
|
||||
|
||||
// Returns if the detection job could not be completed. Contains explanation for
|
||||
// what error occured.
|
||||
StatusMessage *string
|
||||
|
||||
// A list of warnings that occurred during the text-detection operation for the
|
||||
// document.
|
||||
Warnings []types.Warning
|
||||
|
||||
// Metadata pertaining to the operation's result.
|
||||
ResultMetadata middleware.Metadata
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (c *Client) addOperationGetDocumentTextDetectionMiddlewares(stack *middleware.Stack, options Options) (err error) {
|
||||
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetDocumentTextDetection{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetDocumentTextDetection{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := addProtocolFinalizerMiddlewares(stack, options, "GetDocumentTextDetection"); err != nil {
|
||||
return fmt.Errorf("add protocol finalizers: %v", err)
|
||||
}
|
||||
|
||||
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLoggerMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientRequestID(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputeContentLength(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addResolveEndpointMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputePayloadSHA256(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRetry(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRawResponseToMetadata(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecordResponseTiming(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanRetryLoop(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientUserAgent(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addTimeOffsetBuild(stack, c); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addUserAgentRetryMode(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addCredentialSource(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addOpGetDocumentTextDetectionValidationMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetDocumentTextDetection(options.Region), middleware.Before); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecursionDetection(stack); 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
|
||||
}
|
||||
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func newServiceMetadataMiddleware_opGetDocumentTextDetection(region string) *awsmiddleware.RegisterServiceMetadata {
|
||||
return &awsmiddleware.RegisterServiceMetadata{
|
||||
Region: region,
|
||||
ServiceID: ServiceID,
|
||||
OperationName: "GetDocumentTextDetection",
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+217
@@ -0,0 +1,217 @@
|
||||
// Code generated by smithy-go-codegen DO NOT EDIT.
|
||||
|
||||
package textract
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
|
||||
"github.com/aws/aws-sdk-go-v2/service/textract/types"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
)
|
||||
|
||||
// Gets the results for an Amazon Textract asynchronous operation that analyzes
|
||||
// invoices and receipts. Amazon Textract finds contact information, items
|
||||
// purchased, and vendor name, from input invoices and receipts.
|
||||
//
|
||||
// You start asynchronous invoice/receipt analysis by calling StartExpenseAnalysis, which returns a
|
||||
// job identifier ( JobId ). Upon completion of the invoice/receipt analysis,
|
||||
// Amazon Textract publishes the completion status to the Amazon Simple
|
||||
// Notification Service (Amazon SNS) topic. This topic must be registered in the
|
||||
// initial call to StartExpenseAnalysis . To get the results of the invoice/receipt
|
||||
// analysis operation, first ensure that the status value published to the Amazon
|
||||
// SNS topic is SUCCEEDED . If so, call GetExpenseAnalysis , and pass the job
|
||||
// identifier ( JobId ) from the initial call to StartExpenseAnalysis .
|
||||
//
|
||||
// Use the MaxResults parameter to limit the number of blocks that are returned.
|
||||
// If there are more results than specified in MaxResults , the value of NextToken
|
||||
// in the operation response contains a pagination token for getting the next set
|
||||
// of results. To get the next page of results, call GetExpenseAnalysis , and
|
||||
// populate the NextToken request parameter with the token value that's returned
|
||||
// from the previous call to GetExpenseAnalysis .
|
||||
//
|
||||
// For more information, see [Analyzing Invoices and Receipts].
|
||||
//
|
||||
// [Analyzing Invoices and Receipts]: https://docs.aws.amazon.com/textract/latest/dg/invoices-receipts.html
|
||||
func (c *Client) GetExpenseAnalysis(ctx context.Context, params *GetExpenseAnalysisInput, optFns ...func(*Options)) (*GetExpenseAnalysisOutput, error) {
|
||||
if params == nil {
|
||||
params = &GetExpenseAnalysisInput{}
|
||||
}
|
||||
|
||||
result, metadata, err := c.invokeOperation(ctx, "GetExpenseAnalysis", params, optFns, c.addOperationGetExpenseAnalysisMiddlewares)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out := result.(*GetExpenseAnalysisOutput)
|
||||
out.ResultMetadata = metadata
|
||||
return out, nil
|
||||
}
|
||||
|
||||
type GetExpenseAnalysisInput struct {
|
||||
|
||||
// A unique identifier for the text detection job. The JobId is returned from
|
||||
// StartExpenseAnalysis . A JobId value is only valid for 7 days.
|
||||
//
|
||||
// This member is required.
|
||||
JobId *string
|
||||
|
||||
// The maximum number of results to return per paginated call. The largest value
|
||||
// you can specify is 20. If you specify a value greater than 20, a maximum of 20
|
||||
// results is returned. The default value is 20.
|
||||
MaxResults *int32
|
||||
|
||||
// If the previous response was incomplete (because there are more blocks to
|
||||
// retrieve), Amazon Textract returns a pagination token in the response. You can
|
||||
// use this pagination token to retrieve the next set of blocks.
|
||||
NextToken *string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
type GetExpenseAnalysisOutput struct {
|
||||
|
||||
// The current model version of AnalyzeExpense.
|
||||
AnalyzeExpenseModelVersion *string
|
||||
|
||||
// Information about a document that Amazon Textract processed. DocumentMetadata
|
||||
// is returned in every page of paginated responses from an Amazon Textract
|
||||
// operation.
|
||||
DocumentMetadata *types.DocumentMetadata
|
||||
|
||||
// The expenses detected by Amazon Textract.
|
||||
ExpenseDocuments []types.ExpenseDocument
|
||||
|
||||
// The current status of the text detection job.
|
||||
JobStatus types.JobStatus
|
||||
|
||||
// If the response is truncated, Amazon Textract returns this token. You can use
|
||||
// this token in the subsequent request to retrieve the next set of text-detection
|
||||
// results.
|
||||
NextToken *string
|
||||
|
||||
// Returns if the detection job could not be completed. Contains explanation for
|
||||
// what error occured.
|
||||
StatusMessage *string
|
||||
|
||||
// A list of warnings that occurred during the text-detection operation for the
|
||||
// document.
|
||||
Warnings []types.Warning
|
||||
|
||||
// Metadata pertaining to the operation's result.
|
||||
ResultMetadata middleware.Metadata
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (c *Client) addOperationGetExpenseAnalysisMiddlewares(stack *middleware.Stack, options Options) (err error) {
|
||||
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetExpenseAnalysis{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetExpenseAnalysis{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := addProtocolFinalizerMiddlewares(stack, options, "GetExpenseAnalysis"); err != nil {
|
||||
return fmt.Errorf("add protocol finalizers: %v", err)
|
||||
}
|
||||
|
||||
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLoggerMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientRequestID(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputeContentLength(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addResolveEndpointMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputePayloadSHA256(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRetry(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRawResponseToMetadata(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecordResponseTiming(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanRetryLoop(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientUserAgent(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addTimeOffsetBuild(stack, c); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addUserAgentRetryMode(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addCredentialSource(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addOpGetExpenseAnalysisValidationMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetExpenseAnalysis(options.Region), middleware.Before); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecursionDetection(stack); 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
|
||||
}
|
||||
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func newServiceMetadataMiddleware_opGetExpenseAnalysis(region string) *awsmiddleware.RegisterServiceMetadata {
|
||||
return &awsmiddleware.RegisterServiceMetadata{
|
||||
Region: region,
|
||||
ServiceID: ServiceID,
|
||||
OperationName: "GetExpenseAnalysis",
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+205
@@ -0,0 +1,205 @@
|
||||
// Code generated by smithy-go-codegen DO NOT EDIT.
|
||||
|
||||
package textract
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
|
||||
"github.com/aws/aws-sdk-go-v2/service/textract/types"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
)
|
||||
|
||||
// Gets the results for an Amazon Textract asynchronous operation that analyzes
|
||||
// text in a lending document.
|
||||
//
|
||||
// You start asynchronous text analysis by calling StartLendingAnalysis , which
|
||||
// returns a job identifier ( JobId ). When the text analysis operation finishes,
|
||||
// Amazon Textract publishes a completion status to the Amazon Simple Notification
|
||||
// Service (Amazon SNS) topic that's registered in the initial call to
|
||||
// StartLendingAnalysis .
|
||||
//
|
||||
// To get the results of the text analysis operation, first check that the status
|
||||
// value published to the Amazon SNS topic is SUCCEEDED. If so, call
|
||||
// GetLendingAnalysis, and pass the job identifier ( JobId ) from the initial call
|
||||
// to StartLendingAnalysis .
|
||||
func (c *Client) GetLendingAnalysis(ctx context.Context, params *GetLendingAnalysisInput, optFns ...func(*Options)) (*GetLendingAnalysisOutput, error) {
|
||||
if params == nil {
|
||||
params = &GetLendingAnalysisInput{}
|
||||
}
|
||||
|
||||
result, metadata, err := c.invokeOperation(ctx, "GetLendingAnalysis", params, optFns, c.addOperationGetLendingAnalysisMiddlewares)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out := result.(*GetLendingAnalysisOutput)
|
||||
out.ResultMetadata = metadata
|
||||
return out, nil
|
||||
}
|
||||
|
||||
type GetLendingAnalysisInput struct {
|
||||
|
||||
// A unique identifier for the lending or text-detection job. The JobId is
|
||||
// returned from StartLendingAnalysis . A JobId value is only valid for 7 days.
|
||||
//
|
||||
// This member is required.
|
||||
JobId *string
|
||||
|
||||
// The maximum number of results to return per paginated call. The largest value
|
||||
// that you can specify is 30. If you specify a value greater than 30, a maximum of
|
||||
// 30 results is returned. The default value is 30.
|
||||
MaxResults *int32
|
||||
|
||||
// If the previous response was incomplete, Amazon Textract returns a pagination
|
||||
// token in the response. You can use this pagination token to retrieve the next
|
||||
// set of lending results.
|
||||
NextToken *string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
type GetLendingAnalysisOutput struct {
|
||||
|
||||
// The current model version of the Analyze Lending API.
|
||||
AnalyzeLendingModelVersion *string
|
||||
|
||||
// Information about the input document.
|
||||
DocumentMetadata *types.DocumentMetadata
|
||||
|
||||
// The current status of the lending analysis job.
|
||||
JobStatus types.JobStatus
|
||||
|
||||
// If the response is truncated, Amazon Textract returns this token. You can use
|
||||
// this token in the subsequent request to retrieve the next set of lending
|
||||
// results.
|
||||
NextToken *string
|
||||
|
||||
// Holds the information returned by one of AmazonTextract's document analysis
|
||||
// operations for the pinstripe.
|
||||
Results []types.LendingResult
|
||||
|
||||
// Returns if the lending analysis job could not be completed. Contains
|
||||
// explanation for what error occurred.
|
||||
StatusMessage *string
|
||||
|
||||
// A list of warnings that occurred during the lending analysis operation.
|
||||
Warnings []types.Warning
|
||||
|
||||
// Metadata pertaining to the operation's result.
|
||||
ResultMetadata middleware.Metadata
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (c *Client) addOperationGetLendingAnalysisMiddlewares(stack *middleware.Stack, options Options) (err error) {
|
||||
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetLendingAnalysis{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetLendingAnalysis{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := addProtocolFinalizerMiddlewares(stack, options, "GetLendingAnalysis"); err != nil {
|
||||
return fmt.Errorf("add protocol finalizers: %v", err)
|
||||
}
|
||||
|
||||
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLoggerMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientRequestID(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputeContentLength(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addResolveEndpointMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputePayloadSHA256(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRetry(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRawResponseToMetadata(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecordResponseTiming(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanRetryLoop(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientUserAgent(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addTimeOffsetBuild(stack, c); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addUserAgentRetryMode(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addCredentialSource(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addOpGetLendingAnalysisValidationMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetLendingAnalysis(options.Region), middleware.Before); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecursionDetection(stack); 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
|
||||
}
|
||||
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func newServiceMetadataMiddleware_opGetLendingAnalysis(region string) *awsmiddleware.RegisterServiceMetadata {
|
||||
return &awsmiddleware.RegisterServiceMetadata{
|
||||
Region: region,
|
||||
ServiceID: ServiceID,
|
||||
OperationName: "GetLendingAnalysis",
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+192
@@ -0,0 +1,192 @@
|
||||
// Code generated by smithy-go-codegen DO NOT EDIT.
|
||||
|
||||
package textract
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
|
||||
"github.com/aws/aws-sdk-go-v2/service/textract/types"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
)
|
||||
|
||||
// Gets summarized results for the StartLendingAnalysis operation, which analyzes
|
||||
// text in a lending document. The returned summary consists of information about
|
||||
// documents grouped together by a common document type. Information like detected
|
||||
// signatures, page numbers, and split documents is returned with respect to the
|
||||
// type of grouped document.
|
||||
//
|
||||
// You start asynchronous text analysis by calling StartLendingAnalysis , which
|
||||
// returns a job identifier ( JobId ). When the text analysis operation finishes,
|
||||
// Amazon Textract publishes a completion status to the Amazon Simple Notification
|
||||
// Service (Amazon SNS) topic that's registered in the initial call to
|
||||
// StartLendingAnalysis .
|
||||
//
|
||||
// To get the results of the text analysis operation, first check that the status
|
||||
// value published to the Amazon SNS topic is SUCCEEDED. If so, call
|
||||
// GetLendingAnalysisSummary , and pass the job identifier ( JobId ) from the
|
||||
// initial call to StartLendingAnalysis .
|
||||
func (c *Client) GetLendingAnalysisSummary(ctx context.Context, params *GetLendingAnalysisSummaryInput, optFns ...func(*Options)) (*GetLendingAnalysisSummaryOutput, error) {
|
||||
if params == nil {
|
||||
params = &GetLendingAnalysisSummaryInput{}
|
||||
}
|
||||
|
||||
result, metadata, err := c.invokeOperation(ctx, "GetLendingAnalysisSummary", params, optFns, c.addOperationGetLendingAnalysisSummaryMiddlewares)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out := result.(*GetLendingAnalysisSummaryOutput)
|
||||
out.ResultMetadata = metadata
|
||||
return out, nil
|
||||
}
|
||||
|
||||
type GetLendingAnalysisSummaryInput struct {
|
||||
|
||||
// A unique identifier for the lending or text-detection job. The JobId is
|
||||
// returned from StartLendingAnalysis. A JobId value is only valid for 7 days.
|
||||
//
|
||||
// This member is required.
|
||||
JobId *string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
type GetLendingAnalysisSummaryOutput struct {
|
||||
|
||||
// The current model version of the Analyze Lending API.
|
||||
AnalyzeLendingModelVersion *string
|
||||
|
||||
// Information about the input document.
|
||||
DocumentMetadata *types.DocumentMetadata
|
||||
|
||||
// The current status of the lending analysis job.
|
||||
JobStatus types.JobStatus
|
||||
|
||||
// Returns if the lending analysis could not be completed. Contains explanation
|
||||
// for what error occurred.
|
||||
StatusMessage *string
|
||||
|
||||
// Contains summary information for documents grouped by type.
|
||||
Summary *types.LendingSummary
|
||||
|
||||
// A list of warnings that occurred during the lending analysis operation.
|
||||
Warnings []types.Warning
|
||||
|
||||
// Metadata pertaining to the operation's result.
|
||||
ResultMetadata middleware.Metadata
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (c *Client) addOperationGetLendingAnalysisSummaryMiddlewares(stack *middleware.Stack, options Options) (err error) {
|
||||
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetLendingAnalysisSummary{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetLendingAnalysisSummary{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := addProtocolFinalizerMiddlewares(stack, options, "GetLendingAnalysisSummary"); err != nil {
|
||||
return fmt.Errorf("add protocol finalizers: %v", err)
|
||||
}
|
||||
|
||||
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLoggerMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientRequestID(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputeContentLength(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addResolveEndpointMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputePayloadSHA256(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRetry(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRawResponseToMetadata(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecordResponseTiming(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanRetryLoop(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientUserAgent(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addTimeOffsetBuild(stack, c); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addUserAgentRetryMode(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addCredentialSource(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addOpGetLendingAnalysisSummaryValidationMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetLendingAnalysisSummary(options.Region), middleware.Before); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecursionDetection(stack); 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
|
||||
}
|
||||
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func newServiceMetadataMiddleware_opGetLendingAnalysisSummary(region string) *awsmiddleware.RegisterServiceMetadata {
|
||||
return &awsmiddleware.RegisterServiceMetadata{
|
||||
Region: region,
|
||||
ServiceID: ServiceID,
|
||||
OperationName: "GetLendingAnalysisSummary",
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+271
@@ -0,0 +1,271 @@
|
||||
// Code generated by smithy-go-codegen DO NOT EDIT.
|
||||
|
||||
package textract
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
|
||||
"github.com/aws/aws-sdk-go-v2/service/textract/types"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
// List all version of an adapter that meet the specified filtration criteria.
|
||||
func (c *Client) ListAdapterVersions(ctx context.Context, params *ListAdapterVersionsInput, optFns ...func(*Options)) (*ListAdapterVersionsOutput, error) {
|
||||
if params == nil {
|
||||
params = &ListAdapterVersionsInput{}
|
||||
}
|
||||
|
||||
result, metadata, err := c.invokeOperation(ctx, "ListAdapterVersions", params, optFns, c.addOperationListAdapterVersionsMiddlewares)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out := result.(*ListAdapterVersionsOutput)
|
||||
out.ResultMetadata = metadata
|
||||
return out, nil
|
||||
}
|
||||
|
||||
type ListAdapterVersionsInput struct {
|
||||
|
||||
// A string containing a unique ID for the adapter to match for when listing
|
||||
// adapter versions.
|
||||
AdapterId *string
|
||||
|
||||
// Specifies the lower bound for the ListAdapterVersions operation. Ensures
|
||||
// ListAdapterVersions returns only adapter versions created after the specified
|
||||
// creation time.
|
||||
AfterCreationTime *time.Time
|
||||
|
||||
// Specifies the upper bound for the ListAdapterVersions operation. Ensures
|
||||
// ListAdapterVersions returns only adapter versions created after the specified
|
||||
// creation time.
|
||||
BeforeCreationTime *time.Time
|
||||
|
||||
// The maximum number of results to return when listing adapter versions.
|
||||
MaxResults *int32
|
||||
|
||||
// Identifies the next page of results to return when listing adapter versions.
|
||||
NextToken *string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
type ListAdapterVersionsOutput struct {
|
||||
|
||||
// Adapter versions that match the filtering criteria specified when calling
|
||||
// ListAdapters.
|
||||
AdapterVersions []types.AdapterVersionOverview
|
||||
|
||||
// Identifies the next page of results to return when listing adapter versions.
|
||||
NextToken *string
|
||||
|
||||
// Metadata pertaining to the operation's result.
|
||||
ResultMetadata middleware.Metadata
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (c *Client) addOperationListAdapterVersionsMiddlewares(stack *middleware.Stack, options Options) (err error) {
|
||||
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Serialize.Add(&awsAwsjson11_serializeOpListAdapterVersions{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListAdapterVersions{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := addProtocolFinalizerMiddlewares(stack, options, "ListAdapterVersions"); err != nil {
|
||||
return fmt.Errorf("add protocol finalizers: %v", err)
|
||||
}
|
||||
|
||||
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLoggerMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientRequestID(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputeContentLength(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addResolveEndpointMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputePayloadSHA256(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRetry(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRawResponseToMetadata(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecordResponseTiming(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanRetryLoop(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientUserAgent(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addTimeOffsetBuild(stack, c); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addUserAgentRetryMode(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addCredentialSource(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListAdapterVersions(options.Region), middleware.Before); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecursionDetection(stack); 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
|
||||
}
|
||||
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ListAdapterVersionsPaginatorOptions is the paginator options for
|
||||
// ListAdapterVersions
|
||||
type ListAdapterVersionsPaginatorOptions struct {
|
||||
// The maximum number of results to return when listing adapter versions.
|
||||
Limit int32
|
||||
|
||||
// Set to true if pagination should stop if the service returns a pagination token
|
||||
// that matches the most recent token provided to the service.
|
||||
StopOnDuplicateToken bool
|
||||
}
|
||||
|
||||
// ListAdapterVersionsPaginator is a paginator for ListAdapterVersions
|
||||
type ListAdapterVersionsPaginator struct {
|
||||
options ListAdapterVersionsPaginatorOptions
|
||||
client ListAdapterVersionsAPIClient
|
||||
params *ListAdapterVersionsInput
|
||||
nextToken *string
|
||||
firstPage bool
|
||||
}
|
||||
|
||||
// NewListAdapterVersionsPaginator returns a new ListAdapterVersionsPaginator
|
||||
func NewListAdapterVersionsPaginator(client ListAdapterVersionsAPIClient, params *ListAdapterVersionsInput, optFns ...func(*ListAdapterVersionsPaginatorOptions)) *ListAdapterVersionsPaginator {
|
||||
if params == nil {
|
||||
params = &ListAdapterVersionsInput{}
|
||||
}
|
||||
|
||||
options := ListAdapterVersionsPaginatorOptions{}
|
||||
if params.MaxResults != nil {
|
||||
options.Limit = *params.MaxResults
|
||||
}
|
||||
|
||||
for _, fn := range optFns {
|
||||
fn(&options)
|
||||
}
|
||||
|
||||
return &ListAdapterVersionsPaginator{
|
||||
options: options,
|
||||
client: client,
|
||||
params: params,
|
||||
firstPage: true,
|
||||
nextToken: params.NextToken,
|
||||
}
|
||||
}
|
||||
|
||||
// HasMorePages returns a boolean indicating whether more pages are available
|
||||
func (p *ListAdapterVersionsPaginator) HasMorePages() bool {
|
||||
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
|
||||
}
|
||||
|
||||
// NextPage retrieves the next ListAdapterVersions page.
|
||||
func (p *ListAdapterVersionsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListAdapterVersionsOutput, error) {
|
||||
if !p.HasMorePages() {
|
||||
return nil, fmt.Errorf("no more pages available")
|
||||
}
|
||||
|
||||
params := *p.params
|
||||
params.NextToken = p.nextToken
|
||||
|
||||
var limit *int32
|
||||
if p.options.Limit > 0 {
|
||||
limit = &p.options.Limit
|
||||
}
|
||||
params.MaxResults = limit
|
||||
|
||||
optFns = append([]func(*Options){
|
||||
addIsPaginatorUserAgent,
|
||||
}, optFns...)
|
||||
result, err := p.client.ListAdapterVersions(ctx, ¶ms, optFns...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
p.firstPage = false
|
||||
|
||||
prevToken := p.nextToken
|
||||
p.nextToken = result.NextToken
|
||||
|
||||
if p.options.StopOnDuplicateToken &&
|
||||
prevToken != nil &&
|
||||
p.nextToken != nil &&
|
||||
*prevToken == *p.nextToken {
|
||||
p.nextToken = nil
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// ListAdapterVersionsAPIClient is a client that implements the
|
||||
// ListAdapterVersions operation.
|
||||
type ListAdapterVersionsAPIClient interface {
|
||||
ListAdapterVersions(context.Context, *ListAdapterVersionsInput, ...func(*Options)) (*ListAdapterVersionsOutput, error)
|
||||
}
|
||||
|
||||
var _ ListAdapterVersionsAPIClient = (*Client)(nil)
|
||||
|
||||
func newServiceMetadataMiddleware_opListAdapterVersions(region string) *awsmiddleware.RegisterServiceMetadata {
|
||||
return &awsmiddleware.RegisterServiceMetadata{
|
||||
Region: region,
|
||||
ServiceID: ServiceID,
|
||||
OperationName: "ListAdapterVersions",
|
||||
}
|
||||
}
|
||||
+263
@@ -0,0 +1,263 @@
|
||||
// Code generated by smithy-go-codegen DO NOT EDIT.
|
||||
|
||||
package textract
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
|
||||
"github.com/aws/aws-sdk-go-v2/service/textract/types"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Lists all adapters that match the specified filtration criteria.
|
||||
func (c *Client) ListAdapters(ctx context.Context, params *ListAdaptersInput, optFns ...func(*Options)) (*ListAdaptersOutput, error) {
|
||||
if params == nil {
|
||||
params = &ListAdaptersInput{}
|
||||
}
|
||||
|
||||
result, metadata, err := c.invokeOperation(ctx, "ListAdapters", params, optFns, c.addOperationListAdaptersMiddlewares)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out := result.(*ListAdaptersOutput)
|
||||
out.ResultMetadata = metadata
|
||||
return out, nil
|
||||
}
|
||||
|
||||
type ListAdaptersInput struct {
|
||||
|
||||
// Specifies the lower bound for the ListAdapters operation. Ensures ListAdapters
|
||||
// returns only adapters created after the specified creation time.
|
||||
AfterCreationTime *time.Time
|
||||
|
||||
// Specifies the upper bound for the ListAdapters operation. Ensures ListAdapters
|
||||
// returns only adapters created before the specified creation time.
|
||||
BeforeCreationTime *time.Time
|
||||
|
||||
// The maximum number of results to return when listing adapters.
|
||||
MaxResults *int32
|
||||
|
||||
// Identifies the next page of results to return when listing adapters.
|
||||
NextToken *string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
type ListAdaptersOutput struct {
|
||||
|
||||
// A list of adapters that matches the filtering criteria specified when calling
|
||||
// ListAdapters.
|
||||
Adapters []types.AdapterOverview
|
||||
|
||||
// Identifies the next page of results to return when listing adapters.
|
||||
NextToken *string
|
||||
|
||||
// Metadata pertaining to the operation's result.
|
||||
ResultMetadata middleware.Metadata
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (c *Client) addOperationListAdaptersMiddlewares(stack *middleware.Stack, options Options) (err error) {
|
||||
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Serialize.Add(&awsAwsjson11_serializeOpListAdapters{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListAdapters{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := addProtocolFinalizerMiddlewares(stack, options, "ListAdapters"); err != nil {
|
||||
return fmt.Errorf("add protocol finalizers: %v", err)
|
||||
}
|
||||
|
||||
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLoggerMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientRequestID(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputeContentLength(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addResolveEndpointMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputePayloadSHA256(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRetry(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRawResponseToMetadata(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecordResponseTiming(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanRetryLoop(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientUserAgent(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addTimeOffsetBuild(stack, c); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addUserAgentRetryMode(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addCredentialSource(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListAdapters(options.Region), middleware.Before); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecursionDetection(stack); 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
|
||||
}
|
||||
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ListAdaptersPaginatorOptions is the paginator options for ListAdapters
|
||||
type ListAdaptersPaginatorOptions struct {
|
||||
// The maximum number of results to return when listing adapters.
|
||||
Limit int32
|
||||
|
||||
// Set to true if pagination should stop if the service returns a pagination token
|
||||
// that matches the most recent token provided to the service.
|
||||
StopOnDuplicateToken bool
|
||||
}
|
||||
|
||||
// ListAdaptersPaginator is a paginator for ListAdapters
|
||||
type ListAdaptersPaginator struct {
|
||||
options ListAdaptersPaginatorOptions
|
||||
client ListAdaptersAPIClient
|
||||
params *ListAdaptersInput
|
||||
nextToken *string
|
||||
firstPage bool
|
||||
}
|
||||
|
||||
// NewListAdaptersPaginator returns a new ListAdaptersPaginator
|
||||
func NewListAdaptersPaginator(client ListAdaptersAPIClient, params *ListAdaptersInput, optFns ...func(*ListAdaptersPaginatorOptions)) *ListAdaptersPaginator {
|
||||
if params == nil {
|
||||
params = &ListAdaptersInput{}
|
||||
}
|
||||
|
||||
options := ListAdaptersPaginatorOptions{}
|
||||
if params.MaxResults != nil {
|
||||
options.Limit = *params.MaxResults
|
||||
}
|
||||
|
||||
for _, fn := range optFns {
|
||||
fn(&options)
|
||||
}
|
||||
|
||||
return &ListAdaptersPaginator{
|
||||
options: options,
|
||||
client: client,
|
||||
params: params,
|
||||
firstPage: true,
|
||||
nextToken: params.NextToken,
|
||||
}
|
||||
}
|
||||
|
||||
// HasMorePages returns a boolean indicating whether more pages are available
|
||||
func (p *ListAdaptersPaginator) HasMorePages() bool {
|
||||
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
|
||||
}
|
||||
|
||||
// NextPage retrieves the next ListAdapters page.
|
||||
func (p *ListAdaptersPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListAdaptersOutput, error) {
|
||||
if !p.HasMorePages() {
|
||||
return nil, fmt.Errorf("no more pages available")
|
||||
}
|
||||
|
||||
params := *p.params
|
||||
params.NextToken = p.nextToken
|
||||
|
||||
var limit *int32
|
||||
if p.options.Limit > 0 {
|
||||
limit = &p.options.Limit
|
||||
}
|
||||
params.MaxResults = limit
|
||||
|
||||
optFns = append([]func(*Options){
|
||||
addIsPaginatorUserAgent,
|
||||
}, optFns...)
|
||||
result, err := p.client.ListAdapters(ctx, ¶ms, optFns...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
p.firstPage = false
|
||||
|
||||
prevToken := p.nextToken
|
||||
p.nextToken = result.NextToken
|
||||
|
||||
if p.options.StopOnDuplicateToken &&
|
||||
prevToken != nil &&
|
||||
p.nextToken != nil &&
|
||||
*prevToken == *p.nextToken {
|
||||
p.nextToken = nil
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// ListAdaptersAPIClient is a client that implements the ListAdapters operation.
|
||||
type ListAdaptersAPIClient interface {
|
||||
ListAdapters(context.Context, *ListAdaptersInput, ...func(*Options)) (*ListAdaptersOutput, error)
|
||||
}
|
||||
|
||||
var _ ListAdaptersAPIClient = (*Client)(nil)
|
||||
|
||||
func newServiceMetadataMiddleware_opListAdapters(region string) *awsmiddleware.RegisterServiceMetadata {
|
||||
return &awsmiddleware.RegisterServiceMetadata{
|
||||
Region: region,
|
||||
ServiceID: ServiceID,
|
||||
OperationName: "ListAdapters",
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+159
@@ -0,0 +1,159 @@
|
||||
// Code generated by smithy-go-codegen DO NOT EDIT.
|
||||
|
||||
package textract
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
)
|
||||
|
||||
// Lists all tags for an Amazon Textract resource.
|
||||
func (c *Client) ListTagsForResource(ctx context.Context, params *ListTagsForResourceInput, optFns ...func(*Options)) (*ListTagsForResourceOutput, error) {
|
||||
if params == nil {
|
||||
params = &ListTagsForResourceInput{}
|
||||
}
|
||||
|
||||
result, metadata, err := c.invokeOperation(ctx, "ListTagsForResource", params, optFns, c.addOperationListTagsForResourceMiddlewares)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out := result.(*ListTagsForResourceOutput)
|
||||
out.ResultMetadata = metadata
|
||||
return out, nil
|
||||
}
|
||||
|
||||
type ListTagsForResourceInput struct {
|
||||
|
||||
// The Amazon Resource Name (ARN) that specifies the resource to list tags for.
|
||||
//
|
||||
// This member is required.
|
||||
ResourceARN *string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
type ListTagsForResourceOutput struct {
|
||||
|
||||
// A set of tags (key-value pairs) that are part of the requested resource.
|
||||
Tags map[string]string
|
||||
|
||||
// Metadata pertaining to the operation's result.
|
||||
ResultMetadata middleware.Metadata
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (c *Client) addOperationListTagsForResourceMiddlewares(stack *middleware.Stack, options Options) (err error) {
|
||||
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Serialize.Add(&awsAwsjson11_serializeOpListTagsForResource{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListTagsForResource{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := addProtocolFinalizerMiddlewares(stack, options, "ListTagsForResource"); err != nil {
|
||||
return fmt.Errorf("add protocol finalizers: %v", err)
|
||||
}
|
||||
|
||||
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLoggerMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientRequestID(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputeContentLength(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addResolveEndpointMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputePayloadSHA256(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRetry(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRawResponseToMetadata(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecordResponseTiming(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanRetryLoop(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientUserAgent(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addTimeOffsetBuild(stack, c); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addUserAgentRetryMode(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addCredentialSource(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addOpListTagsForResourceValidationMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListTagsForResource(options.Region), middleware.Before); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecursionDetection(stack); 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
|
||||
}
|
||||
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func newServiceMetadataMiddleware_opListTagsForResource(region string) *awsmiddleware.RegisterServiceMetadata {
|
||||
return &awsmiddleware.RegisterServiceMetadata{
|
||||
Region: region,
|
||||
ServiceID: ServiceID,
|
||||
OperationName: "ListTagsForResource",
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+224
@@ -0,0 +1,224 @@
|
||||
// Code generated by smithy-go-codegen DO NOT EDIT.
|
||||
|
||||
package textract
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
|
||||
"github.com/aws/aws-sdk-go-v2/service/textract/types"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
)
|
||||
|
||||
// Starts the asynchronous analysis of an input document for relationships between
|
||||
// detected items such as key-value pairs, tables, and selection elements.
|
||||
//
|
||||
// StartDocumentAnalysis can analyze text in documents that are in JPEG, PNG,
|
||||
// TIFF, and PDF format. The documents are stored in an Amazon S3 bucket. Use DocumentLocationto
|
||||
// specify the bucket name and file name of the document.
|
||||
//
|
||||
// StartDocumentAnalysis returns a job identifier ( JobId ) that you use to get the
|
||||
// results of the operation. When text analysis is finished, Amazon Textract
|
||||
// publishes a completion status to the Amazon Simple Notification Service (Amazon
|
||||
// SNS) topic that you specify in NotificationChannel . To get the results of the
|
||||
// text analysis operation, first check that the status value published to the
|
||||
// Amazon SNS topic is SUCCEEDED . If so, call GetDocumentAnalysis, and pass the job identifier ( JobId
|
||||
// ) from the initial call to StartDocumentAnalysis .
|
||||
//
|
||||
// For more information, see [Document Text Analysis].
|
||||
//
|
||||
// [Document Text Analysis]: https://docs.aws.amazon.com/textract/latest/dg/how-it-works-analyzing.html
|
||||
func (c *Client) StartDocumentAnalysis(ctx context.Context, params *StartDocumentAnalysisInput, optFns ...func(*Options)) (*StartDocumentAnalysisOutput, error) {
|
||||
if params == nil {
|
||||
params = &StartDocumentAnalysisInput{}
|
||||
}
|
||||
|
||||
result, metadata, err := c.invokeOperation(ctx, "StartDocumentAnalysis", params, optFns, c.addOperationStartDocumentAnalysisMiddlewares)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out := result.(*StartDocumentAnalysisOutput)
|
||||
out.ResultMetadata = metadata
|
||||
return out, nil
|
||||
}
|
||||
|
||||
type StartDocumentAnalysisInput struct {
|
||||
|
||||
// The location of the document to be processed.
|
||||
//
|
||||
// This member is required.
|
||||
DocumentLocation *types.DocumentLocation
|
||||
|
||||
// A list of the types of analysis to perform. Add TABLES to the list to return
|
||||
// information about the tables that are detected in the input document. Add FORMS
|
||||
// to return detected form data. To perform both types of analysis, add TABLES and
|
||||
// FORMS to FeatureTypes . All lines and words detected in the document are
|
||||
// included in the response (including text that isn't related to the value of
|
||||
// FeatureTypes ).
|
||||
//
|
||||
// This member is required.
|
||||
FeatureTypes []types.FeatureType
|
||||
|
||||
// Specifies the adapter to be used when analyzing a document.
|
||||
AdaptersConfig *types.AdaptersConfig
|
||||
|
||||
// The idempotent token that you use to identify the start request. If you use the
|
||||
// same token with multiple StartDocumentAnalysis requests, the same JobId is
|
||||
// returned. Use ClientRequestToken to prevent the same job from being
|
||||
// accidentally started more than once. For more information, see [Calling Amazon Textract Asynchronous Operations].
|
||||
//
|
||||
// [Calling Amazon Textract Asynchronous Operations]: https://docs.aws.amazon.com/textract/latest/dg/api-async.html
|
||||
ClientRequestToken *string
|
||||
|
||||
// An identifier that you specify that's included in the completion notification
|
||||
// published to the Amazon SNS topic. For example, you can use JobTag to identify
|
||||
// the type of document that the completion notification corresponds to (such as a
|
||||
// tax form or a receipt).
|
||||
JobTag *string
|
||||
|
||||
// The KMS key used to encrypt the inference results. This can be in either Key ID
|
||||
// or Key Alias format. When a KMS key is provided, the KMS key will be used for
|
||||
// server-side encryption of the objects in the customer bucket. When this
|
||||
// parameter is not enabled, the result will be encrypted server side,using SSE-S3.
|
||||
KMSKeyId *string
|
||||
|
||||
// The Amazon SNS topic ARN that you want Amazon Textract to publish the
|
||||
// completion status of the operation to.
|
||||
NotificationChannel *types.NotificationChannel
|
||||
|
||||
// Sets if the output will go to a customer defined bucket. By default, Amazon
|
||||
// Textract will save the results internally to be accessed by the
|
||||
// GetDocumentAnalysis operation.
|
||||
OutputConfig *types.OutputConfig
|
||||
|
||||
//
|
||||
QueriesConfig *types.QueriesConfig
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
type StartDocumentAnalysisOutput struct {
|
||||
|
||||
// The identifier for the document text detection job. Use JobId to identify the
|
||||
// job in a subsequent call to GetDocumentAnalysis . A JobId value is only valid
|
||||
// for 7 days.
|
||||
JobId *string
|
||||
|
||||
// Metadata pertaining to the operation's result.
|
||||
ResultMetadata middleware.Metadata
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (c *Client) addOperationStartDocumentAnalysisMiddlewares(stack *middleware.Stack, options Options) (err error) {
|
||||
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Serialize.Add(&awsAwsjson11_serializeOpStartDocumentAnalysis{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpStartDocumentAnalysis{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := addProtocolFinalizerMiddlewares(stack, options, "StartDocumentAnalysis"); err != nil {
|
||||
return fmt.Errorf("add protocol finalizers: %v", err)
|
||||
}
|
||||
|
||||
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLoggerMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientRequestID(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputeContentLength(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addResolveEndpointMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputePayloadSHA256(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRetry(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRawResponseToMetadata(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecordResponseTiming(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanRetryLoop(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientUserAgent(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addTimeOffsetBuild(stack, c); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addUserAgentRetryMode(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addCredentialSource(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addOpStartDocumentAnalysisValidationMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartDocumentAnalysis(options.Region), middleware.Before); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecursionDetection(stack); 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
|
||||
}
|
||||
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func newServiceMetadataMiddleware_opStartDocumentAnalysis(region string) *awsmiddleware.RegisterServiceMetadata {
|
||||
return &awsmiddleware.RegisterServiceMetadata{
|
||||
Region: region,
|
||||
ServiceID: ServiceID,
|
||||
OperationName: "StartDocumentAnalysis",
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+208
@@ -0,0 +1,208 @@
|
||||
// Code generated by smithy-go-codegen DO NOT EDIT.
|
||||
|
||||
package textract
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
|
||||
"github.com/aws/aws-sdk-go-v2/service/textract/types"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
)
|
||||
|
||||
// Starts the asynchronous detection of text in a document. Amazon Textract can
|
||||
// detect lines of text and the words that make up a line of text.
|
||||
//
|
||||
// StartDocumentTextDetection can analyze text in documents that are in JPEG, PNG,
|
||||
// TIFF, and PDF format. The documents are stored in an Amazon S3 bucket. Use DocumentLocationto
|
||||
// specify the bucket name and file name of the document.
|
||||
//
|
||||
// StartTextDetection returns a job identifier ( JobId ) that you use to get the
|
||||
// results of the operation. When text detection is finished, Amazon Textract
|
||||
// publishes a completion status to the Amazon Simple Notification Service (Amazon
|
||||
// SNS) topic that you specify in NotificationChannel . To get the results of the
|
||||
// text detection operation, first check that the status value published to the
|
||||
// Amazon SNS topic is SUCCEEDED . If so, call GetDocumentTextDetection, and pass the job identifier ( JobId
|
||||
// ) from the initial call to StartDocumentTextDetection .
|
||||
//
|
||||
// For more information, see [Document Text Detection].
|
||||
//
|
||||
// [Document Text Detection]: https://docs.aws.amazon.com/textract/latest/dg/how-it-works-detecting.html
|
||||
func (c *Client) StartDocumentTextDetection(ctx context.Context, params *StartDocumentTextDetectionInput, optFns ...func(*Options)) (*StartDocumentTextDetectionOutput, error) {
|
||||
if params == nil {
|
||||
params = &StartDocumentTextDetectionInput{}
|
||||
}
|
||||
|
||||
result, metadata, err := c.invokeOperation(ctx, "StartDocumentTextDetection", params, optFns, c.addOperationStartDocumentTextDetectionMiddlewares)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out := result.(*StartDocumentTextDetectionOutput)
|
||||
out.ResultMetadata = metadata
|
||||
return out, nil
|
||||
}
|
||||
|
||||
type StartDocumentTextDetectionInput struct {
|
||||
|
||||
// The location of the document to be processed.
|
||||
//
|
||||
// This member is required.
|
||||
DocumentLocation *types.DocumentLocation
|
||||
|
||||
// The idempotent token that's used to identify the start request. If you use the
|
||||
// same token with multiple StartDocumentTextDetection requests, the same JobId is
|
||||
// returned. Use ClientRequestToken to prevent the same job from being
|
||||
// accidentally started more than once. For more information, see [Calling Amazon Textract Asynchronous Operations].
|
||||
//
|
||||
// [Calling Amazon Textract Asynchronous Operations]: https://docs.aws.amazon.com/textract/latest/dg/api-async.html
|
||||
ClientRequestToken *string
|
||||
|
||||
// An identifier that you specify that's included in the completion notification
|
||||
// published to the Amazon SNS topic. For example, you can use JobTag to identify
|
||||
// the type of document that the completion notification corresponds to (such as a
|
||||
// tax form or a receipt).
|
||||
JobTag *string
|
||||
|
||||
// The KMS key used to encrypt the inference results. This can be in either Key ID
|
||||
// or Key Alias format. When a KMS key is provided, the KMS key will be used for
|
||||
// server-side encryption of the objects in the customer bucket. When this
|
||||
// parameter is not enabled, the result will be encrypted server side,using SSE-S3.
|
||||
KMSKeyId *string
|
||||
|
||||
// The Amazon SNS topic ARN that you want Amazon Textract to publish the
|
||||
// completion status of the operation to.
|
||||
NotificationChannel *types.NotificationChannel
|
||||
|
||||
// Sets if the output will go to a customer defined bucket. By default Amazon
|
||||
// Textract will save the results internally to be accessed with the
|
||||
// GetDocumentTextDetection operation.
|
||||
OutputConfig *types.OutputConfig
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
type StartDocumentTextDetectionOutput struct {
|
||||
|
||||
// The identifier of the text detection job for the document. Use JobId to
|
||||
// identify the job in a subsequent call to GetDocumentTextDetection . A JobId
|
||||
// value is only valid for 7 days.
|
||||
JobId *string
|
||||
|
||||
// Metadata pertaining to the operation's result.
|
||||
ResultMetadata middleware.Metadata
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (c *Client) addOperationStartDocumentTextDetectionMiddlewares(stack *middleware.Stack, options Options) (err error) {
|
||||
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Serialize.Add(&awsAwsjson11_serializeOpStartDocumentTextDetection{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpStartDocumentTextDetection{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := addProtocolFinalizerMiddlewares(stack, options, "StartDocumentTextDetection"); err != nil {
|
||||
return fmt.Errorf("add protocol finalizers: %v", err)
|
||||
}
|
||||
|
||||
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLoggerMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientRequestID(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputeContentLength(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addResolveEndpointMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputePayloadSHA256(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRetry(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRawResponseToMetadata(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecordResponseTiming(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanRetryLoop(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientUserAgent(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addTimeOffsetBuild(stack, c); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addUserAgentRetryMode(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addCredentialSource(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addOpStartDocumentTextDetectionValidationMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartDocumentTextDetection(options.Region), middleware.Before); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecursionDetection(stack); 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
|
||||
}
|
||||
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func newServiceMetadataMiddleware_opStartDocumentTextDetection(region string) *awsmiddleware.RegisterServiceMetadata {
|
||||
return &awsmiddleware.RegisterServiceMetadata{
|
||||
Region: region,
|
||||
ServiceID: ServiceID,
|
||||
OperationName: "StartDocumentTextDetection",
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+209
@@ -0,0 +1,209 @@
|
||||
// Code generated by smithy-go-codegen DO NOT EDIT.
|
||||
|
||||
package textract
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
|
||||
"github.com/aws/aws-sdk-go-v2/service/textract/types"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
)
|
||||
|
||||
// Starts the asynchronous analysis of invoices or receipts for data like contact
|
||||
// information, items purchased, and vendor names.
|
||||
//
|
||||
// StartExpenseAnalysis can analyze text in documents that are in JPEG, PNG, and
|
||||
// PDF format. The documents must be stored in an Amazon S3 bucket. Use the DocumentLocation
|
||||
// parameter to specify the name of your S3 bucket and the name of the document in
|
||||
// that bucket.
|
||||
//
|
||||
// StartExpenseAnalysis returns a job identifier ( JobId ) that you will provide to
|
||||
// GetExpenseAnalysis to retrieve the results of the operation. When the analysis
|
||||
// of the input invoices/receipts is finished, Amazon Textract publishes a
|
||||
// completion status to the Amazon Simple Notification Service (Amazon SNS) topic
|
||||
// that you provide to the NotificationChannel . To obtain the results of the
|
||||
// invoice and receipt analysis operation, ensure that the status value published
|
||||
// to the Amazon SNS topic is SUCCEEDED . If so, call GetExpenseAnalysis, and pass the job
|
||||
// identifier ( JobId ) that was returned by your call to StartExpenseAnalysis .
|
||||
//
|
||||
// For more information, see [Analyzing Invoices and Receipts].
|
||||
//
|
||||
// [Analyzing Invoices and Receipts]: https://docs.aws.amazon.com/textract/latest/dg/invoice-receipts.html
|
||||
func (c *Client) StartExpenseAnalysis(ctx context.Context, params *StartExpenseAnalysisInput, optFns ...func(*Options)) (*StartExpenseAnalysisOutput, error) {
|
||||
if params == nil {
|
||||
params = &StartExpenseAnalysisInput{}
|
||||
}
|
||||
|
||||
result, metadata, err := c.invokeOperation(ctx, "StartExpenseAnalysis", params, optFns, c.addOperationStartExpenseAnalysisMiddlewares)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out := result.(*StartExpenseAnalysisOutput)
|
||||
out.ResultMetadata = metadata
|
||||
return out, nil
|
||||
}
|
||||
|
||||
type StartExpenseAnalysisInput struct {
|
||||
|
||||
// The location of the document to be processed.
|
||||
//
|
||||
// This member is required.
|
||||
DocumentLocation *types.DocumentLocation
|
||||
|
||||
// The idempotent token that's used to identify the start request. If you use the
|
||||
// same token with multiple StartDocumentTextDetection requests, the same JobId is
|
||||
// returned. Use ClientRequestToken to prevent the same job from being
|
||||
// accidentally started more than once. For more information, see [Calling Amazon Textract Asynchronous Operations]
|
||||
//
|
||||
// [Calling Amazon Textract Asynchronous Operations]: https://docs.aws.amazon.com/textract/latest/dg/api-async.html
|
||||
ClientRequestToken *string
|
||||
|
||||
// An identifier you specify that's included in the completion notification
|
||||
// published to the Amazon SNS topic. For example, you can use JobTag to identify
|
||||
// the type of document that the completion notification corresponds to (such as a
|
||||
// tax form or a receipt).
|
||||
JobTag *string
|
||||
|
||||
// The KMS key used to encrypt the inference results. This can be in either Key ID
|
||||
// or Key Alias format. When a KMS key is provided, the KMS key will be used for
|
||||
// server-side encryption of the objects in the customer bucket. When this
|
||||
// parameter is not enabled, the result will be encrypted server side,using SSE-S3.
|
||||
KMSKeyId *string
|
||||
|
||||
// The Amazon SNS topic ARN that you want Amazon Textract to publish the
|
||||
// completion status of the operation to.
|
||||
NotificationChannel *types.NotificationChannel
|
||||
|
||||
// Sets if the output will go to a customer defined bucket. By default, Amazon
|
||||
// Textract will save the results internally to be accessed by the
|
||||
// GetExpenseAnalysis operation.
|
||||
OutputConfig *types.OutputConfig
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
type StartExpenseAnalysisOutput struct {
|
||||
|
||||
// A unique identifier for the text detection job. The JobId is returned from
|
||||
// StartExpenseAnalysis . A JobId value is only valid for 7 days.
|
||||
JobId *string
|
||||
|
||||
// Metadata pertaining to the operation's result.
|
||||
ResultMetadata middleware.Metadata
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (c *Client) addOperationStartExpenseAnalysisMiddlewares(stack *middleware.Stack, options Options) (err error) {
|
||||
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Serialize.Add(&awsAwsjson11_serializeOpStartExpenseAnalysis{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpStartExpenseAnalysis{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := addProtocolFinalizerMiddlewares(stack, options, "StartExpenseAnalysis"); err != nil {
|
||||
return fmt.Errorf("add protocol finalizers: %v", err)
|
||||
}
|
||||
|
||||
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLoggerMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientRequestID(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputeContentLength(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addResolveEndpointMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputePayloadSHA256(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRetry(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRawResponseToMetadata(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecordResponseTiming(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanRetryLoop(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientUserAgent(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addTimeOffsetBuild(stack, c); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addUserAgentRetryMode(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addCredentialSource(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addOpStartExpenseAnalysisValidationMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartExpenseAnalysis(options.Region), middleware.Before); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecursionDetection(stack); 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
|
||||
}
|
||||
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func newServiceMetadataMiddleware_opStartExpenseAnalysis(region string) *awsmiddleware.RegisterServiceMetadata {
|
||||
return &awsmiddleware.RegisterServiceMetadata{
|
||||
Region: region,
|
||||
ServiceID: ServiceID,
|
||||
OperationName: "StartExpenseAnalysis",
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+241
@@ -0,0 +1,241 @@
|
||||
// Code generated by smithy-go-codegen DO NOT EDIT.
|
||||
|
||||
package textract
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
|
||||
"github.com/aws/aws-sdk-go-v2/service/textract/types"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
)
|
||||
|
||||
// Starts the classification and analysis of an input document.
|
||||
// StartLendingAnalysis initiates the classification and analysis of a packet of
|
||||
// lending documents. StartLendingAnalysis operates on a document file located in
|
||||
// an Amazon S3 bucket.
|
||||
//
|
||||
// StartLendingAnalysis can analyze text in documents that are in one of the
|
||||
// following formats: JPEG, PNG, TIFF, PDF. Use DocumentLocation to specify the
|
||||
// bucket name and the file name of the document.
|
||||
//
|
||||
// StartLendingAnalysis returns a job identifier ( JobId ) that you use to get the
|
||||
// results of the operation. When the text analysis is finished, Amazon Textract
|
||||
// publishes a completion status to the Amazon Simple Notification Service (Amazon
|
||||
// SNS) topic that you specify in NotificationChannel . To get the results of the
|
||||
// text analysis operation, first check that the status value published to the
|
||||
// Amazon SNS topic is SUCCEEDED. If the status is SUCCEEDED you can call either
|
||||
// GetLendingAnalysis or GetLendingAnalysisSummary and provide the JobId to obtain
|
||||
// the results of the analysis.
|
||||
//
|
||||
// If using OutputConfig to specify an Amazon S3 bucket, the output will be
|
||||
// contained within the specified prefix in a directory labeled with the job-id. In
|
||||
// the directory there are 3 sub-directories:
|
||||
//
|
||||
// - detailedResponse (contains the GetLendingAnalysis response)
|
||||
//
|
||||
// - summaryResponse (for the GetLendingAnalysisSummary response)
|
||||
//
|
||||
// - splitDocuments (documents split across logical boundaries)
|
||||
func (c *Client) StartLendingAnalysis(ctx context.Context, params *StartLendingAnalysisInput, optFns ...func(*Options)) (*StartLendingAnalysisOutput, error) {
|
||||
if params == nil {
|
||||
params = &StartLendingAnalysisInput{}
|
||||
}
|
||||
|
||||
result, metadata, err := c.invokeOperation(ctx, "StartLendingAnalysis", params, optFns, c.addOperationStartLendingAnalysisMiddlewares)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out := result.(*StartLendingAnalysisOutput)
|
||||
out.ResultMetadata = metadata
|
||||
return out, nil
|
||||
}
|
||||
|
||||
type StartLendingAnalysisInput struct {
|
||||
|
||||
// The Amazon S3 bucket that contains the document to be processed. It's used by
|
||||
// asynchronous operations.
|
||||
//
|
||||
// The input document can be an image file in JPEG or PNG format. It can also be a
|
||||
// file in PDF format.
|
||||
//
|
||||
// This member is required.
|
||||
DocumentLocation *types.DocumentLocation
|
||||
|
||||
// The idempotent token that you use to identify the start request. If you use the
|
||||
// same token with multiple StartLendingAnalysis requests, the same JobId is
|
||||
// returned. Use ClientRequestToken to prevent the same job from being
|
||||
// accidentally started more than once. For more information, see [Calling Amazon Textract Asynchronous Operations].
|
||||
//
|
||||
// [Calling Amazon Textract Asynchronous Operations]: https://docs.aws.amazon.com/textract/latest/dg/api-sync.html
|
||||
ClientRequestToken *string
|
||||
|
||||
// An identifier that you specify to be included in the completion notification
|
||||
// published to the Amazon SNS topic. For example, you can use JobTag to identify
|
||||
// the type of document that the completion notification corresponds to (such as a
|
||||
// tax form or a receipt).
|
||||
JobTag *string
|
||||
|
||||
// The KMS key used to encrypt the inference results. This can be in either Key ID
|
||||
// or Key Alias format. When a KMS key is provided, the KMS key will be used for
|
||||
// server-side encryption of the objects in the customer bucket. When this
|
||||
// parameter is not enabled, the result will be encrypted server side, using
|
||||
// SSE-S3.
|
||||
KMSKeyId *string
|
||||
|
||||
// The Amazon Simple Notification Service (Amazon SNS) topic to which Amazon
|
||||
// Textract publishes the completion status of an asynchronous document operation.
|
||||
NotificationChannel *types.NotificationChannel
|
||||
|
||||
// Sets whether or not your output will go to a user created bucket. Used to set
|
||||
// the name of the bucket, and the prefix on the output file.
|
||||
//
|
||||
// OutputConfig is an optional parameter which lets you adjust where your output
|
||||
// will be placed. By default, Amazon Textract will store the results internally
|
||||
// and can only be accessed by the Get API operations. With OutputConfig enabled,
|
||||
// you can set the name of the bucket the output will be sent to the file prefix of
|
||||
// the results where you can download your results. Additionally, you can set the
|
||||
// KMSKeyID parameter to a customer master key (CMK) to encrypt your output.
|
||||
// Without this parameter set Amazon Textract will encrypt server-side using the
|
||||
// AWS managed CMK for Amazon S3.
|
||||
//
|
||||
// Decryption of Customer Content is necessary for processing of the documents by
|
||||
// Amazon Textract. If your account is opted out under an AI services opt out
|
||||
// policy then all unencrypted Customer Content is immediately and permanently
|
||||
// deleted after the Customer Content has been processed by the service. No copy of
|
||||
// of the output is retained by Amazon Textract. For information about how to opt
|
||||
// out, see [Managing AI services opt-out policy.]
|
||||
//
|
||||
// For more information on data privacy, see the [Data Privacy FAQ].
|
||||
//
|
||||
// [Managing AI services opt-out policy.]: https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_ai-opt-out.html
|
||||
// [Data Privacy FAQ]: https://aws.amazon.com/compliance/data-privacy-faq/
|
||||
OutputConfig *types.OutputConfig
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
type StartLendingAnalysisOutput struct {
|
||||
|
||||
// A unique identifier for the lending or text-detection job. The JobId is
|
||||
// returned from StartLendingAnalysis . A JobId value is only valid for 7 days.
|
||||
JobId *string
|
||||
|
||||
// Metadata pertaining to the operation's result.
|
||||
ResultMetadata middleware.Metadata
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (c *Client) addOperationStartLendingAnalysisMiddlewares(stack *middleware.Stack, options Options) (err error) {
|
||||
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Serialize.Add(&awsAwsjson11_serializeOpStartLendingAnalysis{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpStartLendingAnalysis{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := addProtocolFinalizerMiddlewares(stack, options, "StartLendingAnalysis"); err != nil {
|
||||
return fmt.Errorf("add protocol finalizers: %v", err)
|
||||
}
|
||||
|
||||
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLoggerMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientRequestID(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputeContentLength(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addResolveEndpointMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputePayloadSHA256(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRetry(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRawResponseToMetadata(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecordResponseTiming(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanRetryLoop(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientUserAgent(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addTimeOffsetBuild(stack, c); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addUserAgentRetryMode(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addCredentialSource(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addOpStartLendingAnalysisValidationMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartLendingAnalysis(options.Region), middleware.Before); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecursionDetection(stack); 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
|
||||
}
|
||||
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func newServiceMetadataMiddleware_opStartLendingAnalysis(region string) *awsmiddleware.RegisterServiceMetadata {
|
||||
return &awsmiddleware.RegisterServiceMetadata{
|
||||
Region: region,
|
||||
ServiceID: ServiceID,
|
||||
OperationName: "StartLendingAnalysis",
|
||||
}
|
||||
}
|
||||
+160
@@ -0,0 +1,160 @@
|
||||
// Code generated by smithy-go-codegen DO NOT EDIT.
|
||||
|
||||
package textract
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
)
|
||||
|
||||
// Adds one or more tags to the specified resource.
|
||||
func (c *Client) TagResource(ctx context.Context, params *TagResourceInput, optFns ...func(*Options)) (*TagResourceOutput, error) {
|
||||
if params == nil {
|
||||
params = &TagResourceInput{}
|
||||
}
|
||||
|
||||
result, metadata, err := c.invokeOperation(ctx, "TagResource", params, optFns, c.addOperationTagResourceMiddlewares)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out := result.(*TagResourceOutput)
|
||||
out.ResultMetadata = metadata
|
||||
return out, nil
|
||||
}
|
||||
|
||||
type TagResourceInput struct {
|
||||
|
||||
// The Amazon Resource Name (ARN) that specifies the resource to be tagged.
|
||||
//
|
||||
// This member is required.
|
||||
ResourceARN *string
|
||||
|
||||
// A set of tags (key-value pairs) that you want to assign to the resource.
|
||||
//
|
||||
// This member is required.
|
||||
Tags map[string]string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
type TagResourceOutput struct {
|
||||
// Metadata pertaining to the operation's result.
|
||||
ResultMetadata middleware.Metadata
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (c *Client) addOperationTagResourceMiddlewares(stack *middleware.Stack, options Options) (err error) {
|
||||
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Serialize.Add(&awsAwsjson11_serializeOpTagResource{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpTagResource{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := addProtocolFinalizerMiddlewares(stack, options, "TagResource"); err != nil {
|
||||
return fmt.Errorf("add protocol finalizers: %v", err)
|
||||
}
|
||||
|
||||
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLoggerMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientRequestID(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputeContentLength(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addResolveEndpointMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputePayloadSHA256(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRetry(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRawResponseToMetadata(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecordResponseTiming(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanRetryLoop(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientUserAgent(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addTimeOffsetBuild(stack, c); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addUserAgentRetryMode(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addCredentialSource(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addOpTagResourceValidationMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opTagResource(options.Region), middleware.Before); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecursionDetection(stack); 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
|
||||
}
|
||||
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func newServiceMetadataMiddleware_opTagResource(region string) *awsmiddleware.RegisterServiceMetadata {
|
||||
return &awsmiddleware.RegisterServiceMetadata{
|
||||
Region: region,
|
||||
ServiceID: ServiceID,
|
||||
OperationName: "TagResource",
|
||||
}
|
||||
}
|
||||
+160
@@ -0,0 +1,160 @@
|
||||
// Code generated by smithy-go-codegen DO NOT EDIT.
|
||||
|
||||
package textract
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
)
|
||||
|
||||
// Removes any tags with the specified keys from the specified resource.
|
||||
func (c *Client) UntagResource(ctx context.Context, params *UntagResourceInput, optFns ...func(*Options)) (*UntagResourceOutput, error) {
|
||||
if params == nil {
|
||||
params = &UntagResourceInput{}
|
||||
}
|
||||
|
||||
result, metadata, err := c.invokeOperation(ctx, "UntagResource", params, optFns, c.addOperationUntagResourceMiddlewares)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out := result.(*UntagResourceOutput)
|
||||
out.ResultMetadata = metadata
|
||||
return out, nil
|
||||
}
|
||||
|
||||
type UntagResourceInput struct {
|
||||
|
||||
// The Amazon Resource Name (ARN) that specifies the resource to be untagged.
|
||||
//
|
||||
// This member is required.
|
||||
ResourceARN *string
|
||||
|
||||
// Specifies the tags to be removed from the resource specified by the ResourceARN.
|
||||
//
|
||||
// This member is required.
|
||||
TagKeys []string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
type UntagResourceOutput struct {
|
||||
// Metadata pertaining to the operation's result.
|
||||
ResultMetadata middleware.Metadata
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (c *Client) addOperationUntagResourceMiddlewares(stack *middleware.Stack, options Options) (err error) {
|
||||
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Serialize.Add(&awsAwsjson11_serializeOpUntagResource{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUntagResource{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := addProtocolFinalizerMiddlewares(stack, options, "UntagResource"); err != nil {
|
||||
return fmt.Errorf("add protocol finalizers: %v", err)
|
||||
}
|
||||
|
||||
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLoggerMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientRequestID(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputeContentLength(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addResolveEndpointMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputePayloadSHA256(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRetry(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRawResponseToMetadata(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecordResponseTiming(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanRetryLoop(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientUserAgent(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addTimeOffsetBuild(stack, c); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addUserAgentRetryMode(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addCredentialSource(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addOpUntagResourceValidationMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUntagResource(options.Region), middleware.Before); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecursionDetection(stack); 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
|
||||
}
|
||||
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func newServiceMetadataMiddleware_opUntagResource(region string) *awsmiddleware.RegisterServiceMetadata {
|
||||
return &awsmiddleware.RegisterServiceMetadata{
|
||||
Region: region,
|
||||
ServiceID: ServiceID,
|
||||
OperationName: "UntagResource",
|
||||
}
|
||||
}
|
||||
+186
@@ -0,0 +1,186 @@
|
||||
// Code generated by smithy-go-codegen DO NOT EDIT.
|
||||
|
||||
package textract
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
|
||||
"github.com/aws/aws-sdk-go-v2/service/textract/types"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Update the configuration for an adapter. FeatureTypes configurations cannot be
|
||||
// updated. At least one new parameter must be specified as an argument.
|
||||
func (c *Client) UpdateAdapter(ctx context.Context, params *UpdateAdapterInput, optFns ...func(*Options)) (*UpdateAdapterOutput, error) {
|
||||
if params == nil {
|
||||
params = &UpdateAdapterInput{}
|
||||
}
|
||||
|
||||
result, metadata, err := c.invokeOperation(ctx, "UpdateAdapter", params, optFns, c.addOperationUpdateAdapterMiddlewares)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out := result.(*UpdateAdapterOutput)
|
||||
out.ResultMetadata = metadata
|
||||
return out, nil
|
||||
}
|
||||
|
||||
type UpdateAdapterInput struct {
|
||||
|
||||
// A string containing a unique ID for the adapter that will be updated.
|
||||
//
|
||||
// This member is required.
|
||||
AdapterId *string
|
||||
|
||||
// The new name to be applied to the adapter.
|
||||
AdapterName *string
|
||||
|
||||
// The new auto-update status to be applied to the adapter.
|
||||
AutoUpdate types.AutoUpdate
|
||||
|
||||
// The new description to be applied to the adapter.
|
||||
Description *string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
type UpdateAdapterOutput struct {
|
||||
|
||||
// A string containing a unique ID for the adapter that has been updated.
|
||||
AdapterId *string
|
||||
|
||||
// A string containing the name of the adapter that has been updated.
|
||||
AdapterName *string
|
||||
|
||||
// The auto-update status of the adapter that has been updated.
|
||||
AutoUpdate types.AutoUpdate
|
||||
|
||||
// An object specifying the creation time of the the adapter that has been updated.
|
||||
CreationTime *time.Time
|
||||
|
||||
// A string containing the description of the adapter that has been updated.
|
||||
Description *string
|
||||
|
||||
// List of the targeted feature types for the updated adapter.
|
||||
FeatureTypes []types.FeatureType
|
||||
|
||||
// Metadata pertaining to the operation's result.
|
||||
ResultMetadata middleware.Metadata
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (c *Client) addOperationUpdateAdapterMiddlewares(stack *middleware.Stack, options Options) (err error) {
|
||||
if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Serialize.Add(&awsAwsjson11_serializeOpUpdateAdapter{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUpdateAdapter{}, middleware.After)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := addProtocolFinalizerMiddlewares(stack, options, "UpdateAdapter"); err != nil {
|
||||
return fmt.Errorf("add protocol finalizers: %v", err)
|
||||
}
|
||||
|
||||
if err = addlegacyEndpointContextSetter(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLoggerMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientRequestID(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputeContentLength(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addResolveEndpointMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addComputePayloadSHA256(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRetry(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRawResponseToMetadata(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecordResponseTiming(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanRetryLoop(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addClientUserAgent(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addTimeOffsetBuild(stack, c); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addUserAgentRetryMode(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addCredentialSource(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addOpUpdateAdapterValidationMiddleware(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateAdapter(options.Region), middleware.Before); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addRecursionDetection(stack); 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
|
||||
}
|
||||
if err = addDisableHTTPSMiddleware(stack, options); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanInitializeEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestStart(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = addSpanBuildRequestEnd(stack); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func newServiceMetadataMiddleware_opUpdateAdapter(region string) *awsmiddleware.RegisterServiceMetadata {
|
||||
return &awsmiddleware.RegisterServiceMetadata{
|
||||
Region: region,
|
||||
ServiceID: ServiceID,
|
||||
OperationName: "UpdateAdapter",
|
||||
}
|
||||
}
|
||||
+313
@@ -0,0 +1,313 @@
|
||||
// Code generated by smithy-go-codegen DO NOT EDIT.
|
||||
|
||||
package textract
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
|
||||
smithy "github.com/aws/smithy-go"
|
||||
smithyauth "github.com/aws/smithy-go/auth"
|
||||
"github.com/aws/smithy-go/metrics"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
"github.com/aws/smithy-go/tracing"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
)
|
||||
|
||||
func bindAuthParamsRegion(_ interface{}, params *AuthResolverParameters, _ interface{}, options Options) {
|
||||
params.Region = options.Region
|
||||
}
|
||||
|
||||
type setLegacyContextSigningOptionsMiddleware struct {
|
||||
}
|
||||
|
||||
func (*setLegacyContextSigningOptionsMiddleware) ID() string {
|
||||
return "setLegacyContextSigningOptions"
|
||||
}
|
||||
|
||||
func (m *setLegacyContextSigningOptionsMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) (
|
||||
out middleware.FinalizeOutput, metadata middleware.Metadata, err error,
|
||||
) {
|
||||
rscheme := getResolvedAuthScheme(ctx)
|
||||
schemeID := rscheme.Scheme.SchemeID()
|
||||
|
||||
if sn := awsmiddleware.GetSigningName(ctx); sn != "" {
|
||||
if schemeID == "aws.auth#sigv4" {
|
||||
smithyhttp.SetSigV4SigningName(&rscheme.SignerProperties, sn)
|
||||
} else if schemeID == "aws.auth#sigv4a" {
|
||||
smithyhttp.SetSigV4ASigningName(&rscheme.SignerProperties, sn)
|
||||
}
|
||||
}
|
||||
|
||||
if sr := awsmiddleware.GetSigningRegion(ctx); sr != "" {
|
||||
if schemeID == "aws.auth#sigv4" {
|
||||
smithyhttp.SetSigV4SigningRegion(&rscheme.SignerProperties, sr)
|
||||
} else if schemeID == "aws.auth#sigv4a" {
|
||||
smithyhttp.SetSigV4ASigningRegions(&rscheme.SignerProperties, []string{sr})
|
||||
}
|
||||
}
|
||||
|
||||
return next.HandleFinalize(ctx, in)
|
||||
}
|
||||
|
||||
func addSetLegacyContextSigningOptionsMiddleware(stack *middleware.Stack) error {
|
||||
return stack.Finalize.Insert(&setLegacyContextSigningOptionsMiddleware{}, "Signing", middleware.Before)
|
||||
}
|
||||
|
||||
type withAnonymous struct {
|
||||
resolver AuthSchemeResolver
|
||||
}
|
||||
|
||||
var _ AuthSchemeResolver = (*withAnonymous)(nil)
|
||||
|
||||
func (v *withAnonymous) ResolveAuthSchemes(ctx context.Context, params *AuthResolverParameters) ([]*smithyauth.Option, error) {
|
||||
opts, err := v.resolver.ResolveAuthSchemes(ctx, params)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
opts = append(opts, &smithyauth.Option{
|
||||
SchemeID: smithyauth.SchemeIDAnonymous,
|
||||
})
|
||||
return opts, nil
|
||||
}
|
||||
|
||||
func wrapWithAnonymousAuth(options *Options) {
|
||||
if _, ok := options.AuthSchemeResolver.(*defaultAuthSchemeResolver); !ok {
|
||||
return
|
||||
}
|
||||
|
||||
options.AuthSchemeResolver = &withAnonymous{
|
||||
resolver: options.AuthSchemeResolver,
|
||||
}
|
||||
}
|
||||
|
||||
// AuthResolverParameters contains the set of inputs necessary for auth scheme
|
||||
// resolution.
|
||||
type AuthResolverParameters struct {
|
||||
// The name of the operation being invoked.
|
||||
Operation string
|
||||
|
||||
// The region in which the operation is being invoked.
|
||||
Region string
|
||||
}
|
||||
|
||||
func bindAuthResolverParams(ctx context.Context, operation string, input interface{}, options Options) *AuthResolverParameters {
|
||||
params := &AuthResolverParameters{
|
||||
Operation: operation,
|
||||
}
|
||||
|
||||
bindAuthParamsRegion(ctx, params, input, options)
|
||||
|
||||
return params
|
||||
}
|
||||
|
||||
// AuthSchemeResolver returns a set of possible authentication options for an
|
||||
// operation.
|
||||
type AuthSchemeResolver interface {
|
||||
ResolveAuthSchemes(context.Context, *AuthResolverParameters) ([]*smithyauth.Option, error)
|
||||
}
|
||||
|
||||
type defaultAuthSchemeResolver struct{}
|
||||
|
||||
var _ AuthSchemeResolver = (*defaultAuthSchemeResolver)(nil)
|
||||
|
||||
func (*defaultAuthSchemeResolver) ResolveAuthSchemes(ctx context.Context, params *AuthResolverParameters) ([]*smithyauth.Option, error) {
|
||||
if overrides, ok := operationAuthOptions[params.Operation]; ok {
|
||||
return overrides(params), nil
|
||||
}
|
||||
return serviceAuthOptions(params), nil
|
||||
}
|
||||
|
||||
var operationAuthOptions = map[string]func(*AuthResolverParameters) []*smithyauth.Option{}
|
||||
|
||||
func serviceAuthOptions(params *AuthResolverParameters) []*smithyauth.Option {
|
||||
return []*smithyauth.Option{
|
||||
{
|
||||
SchemeID: smithyauth.SchemeIDSigV4,
|
||||
SignerProperties: func() smithy.Properties {
|
||||
var props smithy.Properties
|
||||
smithyhttp.SetSigV4SigningName(&props, "textract")
|
||||
smithyhttp.SetSigV4SigningRegion(&props, params.Region)
|
||||
return props
|
||||
}(),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
type resolveAuthSchemeMiddleware struct {
|
||||
operation string
|
||||
options Options
|
||||
}
|
||||
|
||||
func (*resolveAuthSchemeMiddleware) ID() string {
|
||||
return "ResolveAuthScheme"
|
||||
}
|
||||
|
||||
func (m *resolveAuthSchemeMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) (
|
||||
out middleware.FinalizeOutput, metadata middleware.Metadata, err error,
|
||||
) {
|
||||
_, span := tracing.StartSpan(ctx, "ResolveAuthScheme")
|
||||
defer span.End()
|
||||
|
||||
params := bindAuthResolverParams(ctx, m.operation, getOperationInput(ctx), m.options)
|
||||
options, err := m.options.AuthSchemeResolver.ResolveAuthSchemes(ctx, params)
|
||||
if err != nil {
|
||||
return out, metadata, fmt.Errorf("resolve auth scheme: %w", err)
|
||||
}
|
||||
|
||||
scheme, ok := m.selectScheme(options)
|
||||
if !ok {
|
||||
return out, metadata, fmt.Errorf("could not select an auth scheme")
|
||||
}
|
||||
|
||||
ctx = setResolvedAuthScheme(ctx, scheme)
|
||||
|
||||
span.SetProperty("auth.scheme_id", scheme.Scheme.SchemeID())
|
||||
span.End()
|
||||
return next.HandleFinalize(ctx, in)
|
||||
}
|
||||
|
||||
func (m *resolveAuthSchemeMiddleware) selectScheme(options []*smithyauth.Option) (*resolvedAuthScheme, bool) {
|
||||
for _, option := range options {
|
||||
if option.SchemeID == smithyauth.SchemeIDAnonymous {
|
||||
return newResolvedAuthScheme(smithyhttp.NewAnonymousScheme(), option), true
|
||||
}
|
||||
|
||||
for _, scheme := range m.options.AuthSchemes {
|
||||
if scheme.SchemeID() != option.SchemeID {
|
||||
continue
|
||||
}
|
||||
|
||||
if scheme.IdentityResolver(m.options) != nil {
|
||||
return newResolvedAuthScheme(scheme, option), true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil, false
|
||||
}
|
||||
|
||||
type resolvedAuthSchemeKey struct{}
|
||||
|
||||
type resolvedAuthScheme struct {
|
||||
Scheme smithyhttp.AuthScheme
|
||||
IdentityProperties smithy.Properties
|
||||
SignerProperties smithy.Properties
|
||||
}
|
||||
|
||||
func newResolvedAuthScheme(scheme smithyhttp.AuthScheme, option *smithyauth.Option) *resolvedAuthScheme {
|
||||
return &resolvedAuthScheme{
|
||||
Scheme: scheme,
|
||||
IdentityProperties: option.IdentityProperties,
|
||||
SignerProperties: option.SignerProperties,
|
||||
}
|
||||
}
|
||||
|
||||
func setResolvedAuthScheme(ctx context.Context, scheme *resolvedAuthScheme) context.Context {
|
||||
return middleware.WithStackValue(ctx, resolvedAuthSchemeKey{}, scheme)
|
||||
}
|
||||
|
||||
func getResolvedAuthScheme(ctx context.Context) *resolvedAuthScheme {
|
||||
v, _ := middleware.GetStackValue(ctx, resolvedAuthSchemeKey{}).(*resolvedAuthScheme)
|
||||
return v
|
||||
}
|
||||
|
||||
type getIdentityMiddleware struct {
|
||||
options Options
|
||||
}
|
||||
|
||||
func (*getIdentityMiddleware) ID() string {
|
||||
return "GetIdentity"
|
||||
}
|
||||
|
||||
func (m *getIdentityMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) (
|
||||
out middleware.FinalizeOutput, metadata middleware.Metadata, err error,
|
||||
) {
|
||||
innerCtx, span := tracing.StartSpan(ctx, "GetIdentity")
|
||||
defer span.End()
|
||||
|
||||
rscheme := getResolvedAuthScheme(innerCtx)
|
||||
if rscheme == nil {
|
||||
return out, metadata, fmt.Errorf("no resolved auth scheme")
|
||||
}
|
||||
|
||||
resolver := rscheme.Scheme.IdentityResolver(m.options)
|
||||
if resolver == nil {
|
||||
return out, metadata, fmt.Errorf("no identity resolver")
|
||||
}
|
||||
|
||||
identity, err := timeOperationMetric(ctx, "client.call.resolve_identity_duration",
|
||||
func() (smithyauth.Identity, error) {
|
||||
return resolver.GetIdentity(innerCtx, rscheme.IdentityProperties)
|
||||
},
|
||||
func(o *metrics.RecordMetricOptions) {
|
||||
o.Properties.Set("auth.scheme_id", rscheme.Scheme.SchemeID())
|
||||
})
|
||||
if err != nil {
|
||||
return out, metadata, fmt.Errorf("get identity: %w", err)
|
||||
}
|
||||
|
||||
ctx = setIdentity(ctx, identity)
|
||||
|
||||
span.End()
|
||||
return next.HandleFinalize(ctx, in)
|
||||
}
|
||||
|
||||
type identityKey struct{}
|
||||
|
||||
func setIdentity(ctx context.Context, identity smithyauth.Identity) context.Context {
|
||||
return middleware.WithStackValue(ctx, identityKey{}, identity)
|
||||
}
|
||||
|
||||
func getIdentity(ctx context.Context) smithyauth.Identity {
|
||||
v, _ := middleware.GetStackValue(ctx, identityKey{}).(smithyauth.Identity)
|
||||
return v
|
||||
}
|
||||
|
||||
type signRequestMiddleware struct {
|
||||
options Options
|
||||
}
|
||||
|
||||
func (*signRequestMiddleware) ID() string {
|
||||
return "Signing"
|
||||
}
|
||||
|
||||
func (m *signRequestMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) (
|
||||
out middleware.FinalizeOutput, metadata middleware.Metadata, err error,
|
||||
) {
|
||||
_, span := tracing.StartSpan(ctx, "SignRequest")
|
||||
defer span.End()
|
||||
|
||||
req, ok := in.Request.(*smithyhttp.Request)
|
||||
if !ok {
|
||||
return out, metadata, fmt.Errorf("unexpected transport type %T", in.Request)
|
||||
}
|
||||
|
||||
rscheme := getResolvedAuthScheme(ctx)
|
||||
if rscheme == nil {
|
||||
return out, metadata, fmt.Errorf("no resolved auth scheme")
|
||||
}
|
||||
|
||||
identity := getIdentity(ctx)
|
||||
if identity == nil {
|
||||
return out, metadata, fmt.Errorf("no identity")
|
||||
}
|
||||
|
||||
signer := rscheme.Scheme.Signer()
|
||||
if signer == nil {
|
||||
return out, metadata, fmt.Errorf("no signer")
|
||||
}
|
||||
|
||||
_, err = timeOperationMetric(ctx, "client.call.signing_duration", func() (any, error) {
|
||||
return nil, signer.SignRequest(ctx, req, identity, rscheme.SignerProperties)
|
||||
}, func(o *metrics.RecordMetricOptions) {
|
||||
o.Properties.Set("auth.scheme_id", rscheme.Scheme.SchemeID())
|
||||
})
|
||||
if err != nil {
|
||||
return out, metadata, fmt.Errorf("sign request: %w", err)
|
||||
}
|
||||
|
||||
span.End()
|
||||
return next.HandleFinalize(ctx, in)
|
||||
}
|
||||
+10173
File diff suppressed because it is too large
Load Diff
+9
@@ -0,0 +1,9 @@
|
||||
// Code generated by smithy-go-codegen DO NOT EDIT.
|
||||
|
||||
// Package textract provides the API client, operations, and parameter types for
|
||||
// Amazon Textract.
|
||||
//
|
||||
// Amazon Textract detects and analyzes text in documents and converts it into
|
||||
// machine-readable text. This is the API reference documentation for Amazon
|
||||
// Textract.
|
||||
package textract
|
||||
+537
@@ -0,0 +1,537 @@
|
||||
// Code generated by smithy-go-codegen DO NOT EDIT.
|
||||
|
||||
package textract
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/aws/aws-sdk-go-v2/aws"
|
||||
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
|
||||
internalConfig "github.com/aws/aws-sdk-go-v2/internal/configsources"
|
||||
"github.com/aws/aws-sdk-go-v2/internal/endpoints"
|
||||
"github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn"
|
||||
internalendpoints "github.com/aws/aws-sdk-go-v2/service/textract/internal/endpoints"
|
||||
smithyauth "github.com/aws/smithy-go/auth"
|
||||
smithyendpoints "github.com/aws/smithy-go/endpoints"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
"github.com/aws/smithy-go/ptr"
|
||||
"github.com/aws/smithy-go/tracing"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// EndpointResolverOptions is the service endpoint resolver options
|
||||
type EndpointResolverOptions = internalendpoints.Options
|
||||
|
||||
// EndpointResolver interface for resolving service endpoints.
|
||||
type EndpointResolver interface {
|
||||
ResolveEndpoint(region string, options EndpointResolverOptions) (aws.Endpoint, error)
|
||||
}
|
||||
|
||||
var _ EndpointResolver = &internalendpoints.Resolver{}
|
||||
|
||||
// NewDefaultEndpointResolver constructs a new service endpoint resolver
|
||||
func NewDefaultEndpointResolver() *internalendpoints.Resolver {
|
||||
return internalendpoints.New()
|
||||
}
|
||||
|
||||
// EndpointResolverFunc is a helper utility that wraps a function so it satisfies
|
||||
// the EndpointResolver interface. This is useful when you want to add additional
|
||||
// endpoint resolving logic, or stub out specific endpoints with custom values.
|
||||
type EndpointResolverFunc func(region string, options EndpointResolverOptions) (aws.Endpoint, error)
|
||||
|
||||
func (fn EndpointResolverFunc) ResolveEndpoint(region string, options EndpointResolverOptions) (endpoint aws.Endpoint, err error) {
|
||||
return fn(region, options)
|
||||
}
|
||||
|
||||
// EndpointResolverFromURL returns an EndpointResolver configured using the
|
||||
// provided endpoint url. By default, the resolved endpoint resolver uses the
|
||||
// client region as signing region, and the endpoint source is set to
|
||||
// EndpointSourceCustom.You can provide functional options to configure endpoint
|
||||
// values for the resolved endpoint.
|
||||
func EndpointResolverFromURL(url string, optFns ...func(*aws.Endpoint)) EndpointResolver {
|
||||
e := aws.Endpoint{URL: url, Source: aws.EndpointSourceCustom}
|
||||
for _, fn := range optFns {
|
||||
fn(&e)
|
||||
}
|
||||
|
||||
return EndpointResolverFunc(
|
||||
func(region string, options EndpointResolverOptions) (aws.Endpoint, error) {
|
||||
if len(e.SigningRegion) == 0 {
|
||||
e.SigningRegion = region
|
||||
}
|
||||
return e, nil
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
type ResolveEndpoint struct {
|
||||
Resolver EndpointResolver
|
||||
Options EndpointResolverOptions
|
||||
}
|
||||
|
||||
func (*ResolveEndpoint) ID() string {
|
||||
return "ResolveEndpoint"
|
||||
}
|
||||
|
||||
func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
|
||||
out middleware.SerializeOutput, metadata middleware.Metadata, err error,
|
||||
) {
|
||||
if !awsmiddleware.GetRequiresLegacyEndpoints(ctx) {
|
||||
return next.HandleSerialize(ctx, in)
|
||||
}
|
||||
|
||||
req, ok := in.Request.(*smithyhttp.Request)
|
||||
if !ok {
|
||||
return out, metadata, fmt.Errorf("unknown transport type %T", in.Request)
|
||||
}
|
||||
|
||||
if m.Resolver == nil {
|
||||
return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil")
|
||||
}
|
||||
|
||||
eo := m.Options
|
||||
eo.Logger = middleware.GetLogger(ctx)
|
||||
|
||||
var endpoint aws.Endpoint
|
||||
endpoint, err = m.Resolver.ResolveEndpoint(awsmiddleware.GetRegion(ctx), eo)
|
||||
if err != nil {
|
||||
nf := (&aws.EndpointNotFoundError{})
|
||||
if errors.As(err, &nf) {
|
||||
ctx = awsmiddleware.SetRequiresLegacyEndpoints(ctx, false)
|
||||
return next.HandleSerialize(ctx, in)
|
||||
}
|
||||
return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err)
|
||||
}
|
||||
|
||||
req.URL, err = url.Parse(endpoint.URL)
|
||||
if err != nil {
|
||||
return out, metadata, fmt.Errorf("failed to parse endpoint URL: %w", err)
|
||||
}
|
||||
|
||||
if len(awsmiddleware.GetSigningName(ctx)) == 0 {
|
||||
signingName := endpoint.SigningName
|
||||
if len(signingName) == 0 {
|
||||
signingName = "textract"
|
||||
}
|
||||
ctx = awsmiddleware.SetSigningName(ctx, signingName)
|
||||
}
|
||||
ctx = awsmiddleware.SetEndpointSource(ctx, endpoint.Source)
|
||||
ctx = smithyhttp.SetHostnameImmutable(ctx, endpoint.HostnameImmutable)
|
||||
ctx = awsmiddleware.SetSigningRegion(ctx, endpoint.SigningRegion)
|
||||
ctx = awsmiddleware.SetPartitionID(ctx, endpoint.PartitionID)
|
||||
return next.HandleSerialize(ctx, in)
|
||||
}
|
||||
func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error {
|
||||
return stack.Serialize.Insert(&ResolveEndpoint{
|
||||
Resolver: o.EndpointResolver,
|
||||
Options: o.EndpointOptions,
|
||||
}, "OperationSerializer", middleware.Before)
|
||||
}
|
||||
|
||||
func removeResolveEndpointMiddleware(stack *middleware.Stack) error {
|
||||
_, err := stack.Serialize.Remove((&ResolveEndpoint{}).ID())
|
||||
return err
|
||||
}
|
||||
|
||||
type wrappedEndpointResolver struct {
|
||||
awsResolver aws.EndpointResolverWithOptions
|
||||
}
|
||||
|
||||
func (w *wrappedEndpointResolver) ResolveEndpoint(region string, options EndpointResolverOptions) (endpoint aws.Endpoint, err error) {
|
||||
return w.awsResolver.ResolveEndpoint(ServiceID, region, options)
|
||||
}
|
||||
|
||||
type awsEndpointResolverAdaptor func(service, region string) (aws.Endpoint, error)
|
||||
|
||||
func (a awsEndpointResolverAdaptor) ResolveEndpoint(service, region string, options ...interface{}) (aws.Endpoint, error) {
|
||||
return a(service, region)
|
||||
}
|
||||
|
||||
var _ aws.EndpointResolverWithOptions = awsEndpointResolverAdaptor(nil)
|
||||
|
||||
// withEndpointResolver returns an aws.EndpointResolverWithOptions that first delegates endpoint resolution to the awsResolver.
|
||||
// If awsResolver returns aws.EndpointNotFoundError error, the v1 resolver middleware will swallow the error,
|
||||
// and set an appropriate context flag such that fallback will occur when EndpointResolverV2 is invoked
|
||||
// via its middleware.
|
||||
//
|
||||
// If another error (besides aws.EndpointNotFoundError) is returned, then that error will be propagated.
|
||||
func withEndpointResolver(awsResolver aws.EndpointResolver, awsResolverWithOptions aws.EndpointResolverWithOptions) EndpointResolver {
|
||||
var resolver aws.EndpointResolverWithOptions
|
||||
|
||||
if awsResolverWithOptions != nil {
|
||||
resolver = awsResolverWithOptions
|
||||
} else if awsResolver != nil {
|
||||
resolver = awsEndpointResolverAdaptor(awsResolver.ResolveEndpoint)
|
||||
}
|
||||
|
||||
return &wrappedEndpointResolver{
|
||||
awsResolver: resolver,
|
||||
}
|
||||
}
|
||||
|
||||
func finalizeClientEndpointResolverOptions(options *Options) {
|
||||
options.EndpointOptions.LogDeprecated = options.ClientLogMode.IsDeprecatedUsage()
|
||||
|
||||
if len(options.EndpointOptions.ResolvedRegion) == 0 {
|
||||
const fipsInfix = "-fips-"
|
||||
const fipsPrefix = "fips-"
|
||||
const fipsSuffix = "-fips"
|
||||
|
||||
if strings.Contains(options.Region, fipsInfix) ||
|
||||
strings.Contains(options.Region, fipsPrefix) ||
|
||||
strings.Contains(options.Region, fipsSuffix) {
|
||||
options.EndpointOptions.ResolvedRegion = strings.ReplaceAll(strings.ReplaceAll(strings.ReplaceAll(
|
||||
options.Region, fipsInfix, "-"), fipsPrefix, ""), fipsSuffix, "")
|
||||
options.EndpointOptions.UseFIPSEndpoint = aws.FIPSEndpointStateEnabled
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func resolveEndpointResolverV2(options *Options) {
|
||||
if options.EndpointResolverV2 == nil {
|
||||
options.EndpointResolverV2 = NewDefaultEndpointResolverV2()
|
||||
}
|
||||
}
|
||||
|
||||
func resolveBaseEndpoint(cfg aws.Config, o *Options) {
|
||||
if cfg.BaseEndpoint != nil {
|
||||
o.BaseEndpoint = cfg.BaseEndpoint
|
||||
}
|
||||
|
||||
_, g := os.LookupEnv("AWS_ENDPOINT_URL")
|
||||
_, s := os.LookupEnv("AWS_ENDPOINT_URL_TEXTRACT")
|
||||
|
||||
if g && !s {
|
||||
return
|
||||
}
|
||||
|
||||
value, found, err := internalConfig.ResolveServiceBaseEndpoint(context.Background(), "Textract", cfg.ConfigSources)
|
||||
if found && err == nil {
|
||||
o.BaseEndpoint = &value
|
||||
}
|
||||
}
|
||||
|
||||
func bindRegion(region string) *string {
|
||||
if region == "" {
|
||||
return nil
|
||||
}
|
||||
return aws.String(endpoints.MapFIPSRegion(region))
|
||||
}
|
||||
|
||||
// EndpointParameters provides the parameters that influence how endpoints are
|
||||
// resolved.
|
||||
type EndpointParameters struct {
|
||||
// The AWS region used to dispatch the request.
|
||||
//
|
||||
// Parameter is
|
||||
// required.
|
||||
//
|
||||
// AWS::Region
|
||||
Region *string
|
||||
|
||||
// When true, use the dual-stack endpoint. If the configured endpoint does not
|
||||
// support dual-stack, dispatching the request MAY return an error.
|
||||
//
|
||||
// Defaults to
|
||||
// false if no value is provided.
|
||||
//
|
||||
// AWS::UseDualStack
|
||||
UseDualStack *bool
|
||||
|
||||
// When true, send this request to the FIPS-compliant regional endpoint. If the
|
||||
// configured endpoint does not have a FIPS compliant endpoint, dispatching the
|
||||
// request will return an error.
|
||||
//
|
||||
// Defaults to false if no value is
|
||||
// provided.
|
||||
//
|
||||
// AWS::UseFIPS
|
||||
UseFIPS *bool
|
||||
|
||||
// Override the endpoint used to send this request
|
||||
//
|
||||
// Parameter is
|
||||
// required.
|
||||
//
|
||||
// SDK::Endpoint
|
||||
Endpoint *string
|
||||
}
|
||||
|
||||
// ValidateRequired validates required parameters are set.
|
||||
func (p EndpointParameters) ValidateRequired() error {
|
||||
if p.UseDualStack == nil {
|
||||
return fmt.Errorf("parameter UseDualStack is required")
|
||||
}
|
||||
|
||||
if p.UseFIPS == nil {
|
||||
return fmt.Errorf("parameter UseFIPS is required")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// WithDefaults returns a shallow copy of EndpointParameterswith default values
|
||||
// applied to members where applicable.
|
||||
func (p EndpointParameters) WithDefaults() EndpointParameters {
|
||||
if p.UseDualStack == nil {
|
||||
p.UseDualStack = ptr.Bool(false)
|
||||
}
|
||||
|
||||
if p.UseFIPS == nil {
|
||||
p.UseFIPS = ptr.Bool(false)
|
||||
}
|
||||
return p
|
||||
}
|
||||
|
||||
type stringSlice []string
|
||||
|
||||
func (s stringSlice) Get(i int) *string {
|
||||
if i < 0 || i >= len(s) {
|
||||
return nil
|
||||
}
|
||||
|
||||
v := s[i]
|
||||
return &v
|
||||
}
|
||||
|
||||
// EndpointResolverV2 provides the interface for resolving service endpoints.
|
||||
type EndpointResolverV2 interface {
|
||||
// ResolveEndpoint attempts to resolve the endpoint with the provided options,
|
||||
// returning the endpoint if found. Otherwise an error is returned.
|
||||
ResolveEndpoint(ctx context.Context, params EndpointParameters) (
|
||||
smithyendpoints.Endpoint, error,
|
||||
)
|
||||
}
|
||||
|
||||
// resolver provides the implementation for resolving endpoints.
|
||||
type resolver struct{}
|
||||
|
||||
func NewDefaultEndpointResolverV2() EndpointResolverV2 {
|
||||
return &resolver{}
|
||||
}
|
||||
|
||||
// ResolveEndpoint attempts to resolve the endpoint with the provided options,
|
||||
// returning the endpoint if found. Otherwise an error is returned.
|
||||
func (r *resolver) ResolveEndpoint(
|
||||
ctx context.Context, params EndpointParameters,
|
||||
) (
|
||||
endpoint smithyendpoints.Endpoint, err error,
|
||||
) {
|
||||
params = params.WithDefaults()
|
||||
if err = params.ValidateRequired(); err != nil {
|
||||
return endpoint, fmt.Errorf("endpoint parameters are not valid, %w", err)
|
||||
}
|
||||
_UseDualStack := *params.UseDualStack
|
||||
_UseFIPS := *params.UseFIPS
|
||||
|
||||
if exprVal := params.Endpoint; exprVal != nil {
|
||||
_Endpoint := *exprVal
|
||||
_ = _Endpoint
|
||||
if _UseFIPS == true {
|
||||
return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Configuration: FIPS and custom endpoint are not supported")
|
||||
}
|
||||
if _UseDualStack == true {
|
||||
return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Configuration: Dualstack and custom endpoint are not supported")
|
||||
}
|
||||
uriString := _Endpoint
|
||||
|
||||
uri, err := url.Parse(uriString)
|
||||
if err != nil {
|
||||
return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString)
|
||||
}
|
||||
|
||||
return smithyendpoints.Endpoint{
|
||||
URI: *uri,
|
||||
Headers: http.Header{},
|
||||
}, nil
|
||||
}
|
||||
if exprVal := params.Region; exprVal != nil {
|
||||
_Region := *exprVal
|
||||
_ = _Region
|
||||
if exprVal := awsrulesfn.GetPartition(_Region); exprVal != nil {
|
||||
_PartitionResult := *exprVal
|
||||
_ = _PartitionResult
|
||||
if _UseFIPS == true {
|
||||
if _UseDualStack == true {
|
||||
if true == _PartitionResult.SupportsFIPS {
|
||||
if true == _PartitionResult.SupportsDualStack {
|
||||
uriString := func() string {
|
||||
var out strings.Builder
|
||||
out.WriteString("https://textract-fips.")
|
||||
out.WriteString(_Region)
|
||||
out.WriteString(".")
|
||||
out.WriteString(_PartitionResult.DualStackDnsSuffix)
|
||||
return out.String()
|
||||
}()
|
||||
|
||||
uri, err := url.Parse(uriString)
|
||||
if err != nil {
|
||||
return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString)
|
||||
}
|
||||
|
||||
return smithyendpoints.Endpoint{
|
||||
URI: *uri,
|
||||
Headers: http.Header{},
|
||||
}, nil
|
||||
}
|
||||
}
|
||||
return endpoint, fmt.Errorf("endpoint rule error, %s", "FIPS and DualStack are enabled, but this partition does not support one or both")
|
||||
}
|
||||
}
|
||||
if _UseFIPS == true {
|
||||
if true == _PartitionResult.SupportsFIPS {
|
||||
uriString := func() string {
|
||||
var out strings.Builder
|
||||
out.WriteString("https://textract-fips.")
|
||||
out.WriteString(_Region)
|
||||
out.WriteString(".")
|
||||
out.WriteString(_PartitionResult.DnsSuffix)
|
||||
return out.String()
|
||||
}()
|
||||
|
||||
uri, err := url.Parse(uriString)
|
||||
if err != nil {
|
||||
return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString)
|
||||
}
|
||||
|
||||
return smithyendpoints.Endpoint{
|
||||
URI: *uri,
|
||||
Headers: http.Header{},
|
||||
}, nil
|
||||
}
|
||||
return endpoint, fmt.Errorf("endpoint rule error, %s", "FIPS is enabled but this partition does not support FIPS")
|
||||
}
|
||||
if _UseDualStack == true {
|
||||
if true == _PartitionResult.SupportsDualStack {
|
||||
uriString := func() string {
|
||||
var out strings.Builder
|
||||
out.WriteString("https://textract.")
|
||||
out.WriteString(_Region)
|
||||
out.WriteString(".")
|
||||
out.WriteString(_PartitionResult.DualStackDnsSuffix)
|
||||
return out.String()
|
||||
}()
|
||||
|
||||
uri, err := url.Parse(uriString)
|
||||
if err != nil {
|
||||
return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString)
|
||||
}
|
||||
|
||||
return smithyendpoints.Endpoint{
|
||||
URI: *uri,
|
||||
Headers: http.Header{},
|
||||
}, nil
|
||||
}
|
||||
return endpoint, fmt.Errorf("endpoint rule error, %s", "DualStack is enabled but this partition does not support DualStack")
|
||||
}
|
||||
uriString := func() string {
|
||||
var out strings.Builder
|
||||
out.WriteString("https://textract.")
|
||||
out.WriteString(_Region)
|
||||
out.WriteString(".")
|
||||
out.WriteString(_PartitionResult.DnsSuffix)
|
||||
return out.String()
|
||||
}()
|
||||
|
||||
uri, err := url.Parse(uriString)
|
||||
if err != nil {
|
||||
return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString)
|
||||
}
|
||||
|
||||
return smithyendpoints.Endpoint{
|
||||
URI: *uri,
|
||||
Headers: http.Header{},
|
||||
}, nil
|
||||
}
|
||||
return endpoint, fmt.Errorf("Endpoint resolution failed. Invalid operation or environment input.")
|
||||
}
|
||||
return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Configuration: Missing Region")
|
||||
}
|
||||
|
||||
type endpointParamsBinder interface {
|
||||
bindEndpointParams(*EndpointParameters)
|
||||
}
|
||||
|
||||
func bindEndpointParams(ctx context.Context, input interface{}, options Options) *EndpointParameters {
|
||||
params := &EndpointParameters{}
|
||||
|
||||
params.Region = bindRegion(options.Region)
|
||||
params.UseDualStack = aws.Bool(options.EndpointOptions.UseDualStackEndpoint == aws.DualStackEndpointStateEnabled)
|
||||
params.UseFIPS = aws.Bool(options.EndpointOptions.UseFIPSEndpoint == aws.FIPSEndpointStateEnabled)
|
||||
params.Endpoint = options.BaseEndpoint
|
||||
|
||||
if b, ok := input.(endpointParamsBinder); ok {
|
||||
b.bindEndpointParams(params)
|
||||
}
|
||||
|
||||
return params
|
||||
}
|
||||
|
||||
type resolveEndpointV2Middleware struct {
|
||||
options Options
|
||||
}
|
||||
|
||||
func (*resolveEndpointV2Middleware) ID() string {
|
||||
return "ResolveEndpointV2"
|
||||
}
|
||||
|
||||
func (m *resolveEndpointV2Middleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) (
|
||||
out middleware.FinalizeOutput, metadata middleware.Metadata, err error,
|
||||
) {
|
||||
_, span := tracing.StartSpan(ctx, "ResolveEndpoint")
|
||||
defer span.End()
|
||||
|
||||
if awsmiddleware.GetRequiresLegacyEndpoints(ctx) {
|
||||
return next.HandleFinalize(ctx, in)
|
||||
}
|
||||
|
||||
req, ok := in.Request.(*smithyhttp.Request)
|
||||
if !ok {
|
||||
return out, metadata, fmt.Errorf("unknown transport type %T", in.Request)
|
||||
}
|
||||
|
||||
if m.options.EndpointResolverV2 == nil {
|
||||
return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil")
|
||||
}
|
||||
|
||||
params := bindEndpointParams(ctx, getOperationInput(ctx), m.options)
|
||||
endpt, err := timeOperationMetric(ctx, "client.call.resolve_endpoint_duration",
|
||||
func() (smithyendpoints.Endpoint, error) {
|
||||
return m.options.EndpointResolverV2.ResolveEndpoint(ctx, *params)
|
||||
})
|
||||
if err != nil {
|
||||
return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err)
|
||||
}
|
||||
|
||||
span.SetProperty("client.call.resolved_endpoint", endpt.URI.String())
|
||||
|
||||
if endpt.URI.RawPath == "" && req.URL.RawPath != "" {
|
||||
endpt.URI.RawPath = endpt.URI.Path
|
||||
}
|
||||
req.URL.Scheme = endpt.URI.Scheme
|
||||
req.URL.Host = endpt.URI.Host
|
||||
req.URL.Path = smithyhttp.JoinPath(endpt.URI.Path, req.URL.Path)
|
||||
req.URL.RawPath = smithyhttp.JoinPath(endpt.URI.RawPath, req.URL.RawPath)
|
||||
for k := range endpt.Headers {
|
||||
req.Header.Set(k, endpt.Headers.Get(k))
|
||||
}
|
||||
|
||||
rscheme := getResolvedAuthScheme(ctx)
|
||||
if rscheme == nil {
|
||||
return out, metadata, fmt.Errorf("no resolved auth scheme")
|
||||
}
|
||||
|
||||
opts, _ := smithyauth.GetAuthOptions(&endpt.Properties)
|
||||
for _, o := range opts {
|
||||
rscheme.SignerProperties.SetAll(&o.SignerProperties)
|
||||
}
|
||||
|
||||
span.End()
|
||||
return next.HandleFinalize(ctx, in)
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"github.com/aws/aws-sdk-go-v2": "v1.4.0",
|
||||
"github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000",
|
||||
"github.com/aws/aws-sdk-go-v2/internal/endpoints/v2": "v2.0.0-00010101000000-000000000000",
|
||||
"github.com/aws/smithy-go": "v1.4.0"
|
||||
},
|
||||
"files": [
|
||||
"api_client.go",
|
||||
"api_client_test.go",
|
||||
"api_op_AnalyzeDocument.go",
|
||||
"api_op_AnalyzeExpense.go",
|
||||
"api_op_AnalyzeID.go",
|
||||
"api_op_CreateAdapter.go",
|
||||
"api_op_CreateAdapterVersion.go",
|
||||
"api_op_DeleteAdapter.go",
|
||||
"api_op_DeleteAdapterVersion.go",
|
||||
"api_op_DetectDocumentText.go",
|
||||
"api_op_GetAdapter.go",
|
||||
"api_op_GetAdapterVersion.go",
|
||||
"api_op_GetDocumentAnalysis.go",
|
||||
"api_op_GetDocumentTextDetection.go",
|
||||
"api_op_GetExpenseAnalysis.go",
|
||||
"api_op_GetLendingAnalysis.go",
|
||||
"api_op_GetLendingAnalysisSummary.go",
|
||||
"api_op_ListAdapterVersions.go",
|
||||
"api_op_ListAdapters.go",
|
||||
"api_op_ListTagsForResource.go",
|
||||
"api_op_StartDocumentAnalysis.go",
|
||||
"api_op_StartDocumentTextDetection.go",
|
||||
"api_op_StartExpenseAnalysis.go",
|
||||
"api_op_StartLendingAnalysis.go",
|
||||
"api_op_TagResource.go",
|
||||
"api_op_UntagResource.go",
|
||||
"api_op_UpdateAdapter.go",
|
||||
"auth.go",
|
||||
"deserializers.go",
|
||||
"doc.go",
|
||||
"endpoints.go",
|
||||
"endpoints_config_test.go",
|
||||
"endpoints_test.go",
|
||||
"generated.json",
|
||||
"internal/endpoints/endpoints.go",
|
||||
"internal/endpoints/endpoints_test.go",
|
||||
"options.go",
|
||||
"protocol_test.go",
|
||||
"serializers.go",
|
||||
"snapshot_test.go",
|
||||
"sra_operation_order_test.go",
|
||||
"types/enums.go",
|
||||
"types/errors.go",
|
||||
"types/types.go",
|
||||
"validators.go"
|
||||
],
|
||||
"go": "1.22",
|
||||
"module": "github.com/aws/aws-sdk-go-v2/service/textract",
|
||||
"unstable": false
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// Code generated by internal/repotools/cmd/updatemodulemeta DO NOT EDIT.
|
||||
|
||||
package textract
|
||||
|
||||
// goModuleVersion is the tagged release for this module
|
||||
const goModuleVersion = "1.35.1"
|
||||
Generated
Vendored
+604
@@ -0,0 +1,604 @@
|
||||
// Code generated by smithy-go-codegen DO NOT EDIT.
|
||||
|
||||
package endpoints
|
||||
|
||||
import (
|
||||
"github.com/aws/aws-sdk-go-v2/aws"
|
||||
endpoints "github.com/aws/aws-sdk-go-v2/internal/endpoints/v2"
|
||||
"github.com/aws/smithy-go/logging"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
// Options is the endpoint resolver configuration options
|
||||
type Options struct {
|
||||
// Logger is a logging implementation that log events should be sent to.
|
||||
Logger logging.Logger
|
||||
|
||||
// LogDeprecated indicates that deprecated endpoints should be logged to the
|
||||
// provided logger.
|
||||
LogDeprecated bool
|
||||
|
||||
// ResolvedRegion is used to override the region to be resolved, rather then the
|
||||
// using the value passed to the ResolveEndpoint method. This value is used by the
|
||||
// SDK to translate regions like fips-us-east-1 or us-east-1-fips to an alternative
|
||||
// name. You must not set this value directly in your application.
|
||||
ResolvedRegion string
|
||||
|
||||
// DisableHTTPS informs the resolver to return an endpoint that does not use the
|
||||
// HTTPS scheme.
|
||||
DisableHTTPS bool
|
||||
|
||||
// UseDualStackEndpoint specifies the resolver must resolve a dual-stack endpoint.
|
||||
UseDualStackEndpoint aws.DualStackEndpointState
|
||||
|
||||
// UseFIPSEndpoint specifies the resolver must resolve a FIPS endpoint.
|
||||
UseFIPSEndpoint aws.FIPSEndpointState
|
||||
}
|
||||
|
||||
func (o Options) GetResolvedRegion() string {
|
||||
return o.ResolvedRegion
|
||||
}
|
||||
|
||||
func (o Options) GetDisableHTTPS() bool {
|
||||
return o.DisableHTTPS
|
||||
}
|
||||
|
||||
func (o Options) GetUseDualStackEndpoint() aws.DualStackEndpointState {
|
||||
return o.UseDualStackEndpoint
|
||||
}
|
||||
|
||||
func (o Options) GetUseFIPSEndpoint() aws.FIPSEndpointState {
|
||||
return o.UseFIPSEndpoint
|
||||
}
|
||||
|
||||
func transformToSharedOptions(options Options) endpoints.Options {
|
||||
return endpoints.Options{
|
||||
Logger: options.Logger,
|
||||
LogDeprecated: options.LogDeprecated,
|
||||
ResolvedRegion: options.ResolvedRegion,
|
||||
DisableHTTPS: options.DisableHTTPS,
|
||||
UseDualStackEndpoint: options.UseDualStackEndpoint,
|
||||
UseFIPSEndpoint: options.UseFIPSEndpoint,
|
||||
}
|
||||
}
|
||||
|
||||
// Resolver Textract endpoint resolver
|
||||
type Resolver struct {
|
||||
partitions endpoints.Partitions
|
||||
}
|
||||
|
||||
// ResolveEndpoint resolves the service endpoint for the given region and options
|
||||
func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws.Endpoint, err error) {
|
||||
if len(region) == 0 {
|
||||
return endpoint, &aws.MissingRegionError{}
|
||||
}
|
||||
|
||||
opt := transformToSharedOptions(options)
|
||||
return r.partitions.ResolveEndpoint(region, opt)
|
||||
}
|
||||
|
||||
// New returns a new Resolver
|
||||
func New() *Resolver {
|
||||
return &Resolver{
|
||||
partitions: defaultPartitions,
|
||||
}
|
||||
}
|
||||
|
||||
var partitionRegexp = struct {
|
||||
Aws *regexp.Regexp
|
||||
AwsCn *regexp.Regexp
|
||||
AwsIso *regexp.Regexp
|
||||
AwsIsoB *regexp.Regexp
|
||||
AwsIsoE *regexp.Regexp
|
||||
AwsIsoF *regexp.Regexp
|
||||
AwsUsGov *regexp.Regexp
|
||||
}{
|
||||
|
||||
Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af|il|mx)\\-\\w+\\-\\d+$"),
|
||||
AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"),
|
||||
AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"),
|
||||
AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"),
|
||||
AwsIsoE: regexp.MustCompile("^eu\\-isoe\\-\\w+\\-\\d+$"),
|
||||
AwsIsoF: regexp.MustCompile("^us\\-isof\\-\\w+\\-\\d+$"),
|
||||
AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"),
|
||||
}
|
||||
|
||||
var defaultPartitions = endpoints.Partitions{
|
||||
{
|
||||
ID: "aws",
|
||||
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
|
||||
{
|
||||
Variant: endpoints.DualStackVariant,
|
||||
}: {
|
||||
Hostname: "textract.{region}.api.aws",
|
||||
Protocols: []string{"https"},
|
||||
SignatureVersions: []string{"v4"},
|
||||
},
|
||||
{
|
||||
Variant: endpoints.FIPSVariant,
|
||||
}: {
|
||||
Hostname: "textract-fips.{region}.amazonaws.com",
|
||||
Protocols: []string{"https"},
|
||||
SignatureVersions: []string{"v4"},
|
||||
},
|
||||
{
|
||||
Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
|
||||
}: {
|
||||
Hostname: "textract-fips.{region}.api.aws",
|
||||
Protocols: []string{"https"},
|
||||
SignatureVersions: []string{"v4"},
|
||||
},
|
||||
{
|
||||
Variant: 0,
|
||||
}: {
|
||||
Hostname: "textract.{region}.amazonaws.com",
|
||||
Protocols: []string{"https"},
|
||||
SignatureVersions: []string{"v4"},
|
||||
},
|
||||
},
|
||||
RegionRegex: partitionRegexp.Aws,
|
||||
IsRegionalized: true,
|
||||
Endpoints: endpoints.Endpoints{
|
||||
endpoints.EndpointKey{
|
||||
Region: "ap-northeast-2",
|
||||
}: endpoints.Endpoint{},
|
||||
endpoints.EndpointKey{
|
||||
Region: "ap-northeast-2",
|
||||
Variant: endpoints.DualStackVariant,
|
||||
}: {
|
||||
Hostname: "textract.ap-northeast-2.api.aws",
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "ap-south-1",
|
||||
}: endpoints.Endpoint{},
|
||||
endpoints.EndpointKey{
|
||||
Region: "ap-south-1",
|
||||
Variant: endpoints.DualStackVariant,
|
||||
}: {
|
||||
Hostname: "textract.ap-south-1.api.aws",
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "ap-southeast-1",
|
||||
}: endpoints.Endpoint{},
|
||||
endpoints.EndpointKey{
|
||||
Region: "ap-southeast-1",
|
||||
Variant: endpoints.DualStackVariant,
|
||||
}: {
|
||||
Hostname: "textract.ap-southeast-1.api.aws",
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "ap-southeast-2",
|
||||
}: endpoints.Endpoint{},
|
||||
endpoints.EndpointKey{
|
||||
Region: "ap-southeast-2",
|
||||
Variant: endpoints.DualStackVariant,
|
||||
}: {
|
||||
Hostname: "textract.ap-southeast-2.api.aws",
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "ca-central-1",
|
||||
}: endpoints.Endpoint{},
|
||||
endpoints.EndpointKey{
|
||||
Region: "ca-central-1",
|
||||
Variant: endpoints.FIPSVariant,
|
||||
}: {
|
||||
Hostname: "textract-fips.ca-central-1.amazonaws.com",
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "ca-central-1",
|
||||
Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
|
||||
}: {
|
||||
Hostname: "textract-fips.ca-central-1.api.aws",
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "ca-central-1",
|
||||
Variant: endpoints.DualStackVariant,
|
||||
}: {
|
||||
Hostname: "textract.ca-central-1.api.aws",
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "eu-central-1",
|
||||
}: endpoints.Endpoint{},
|
||||
endpoints.EndpointKey{
|
||||
Region: "eu-central-1",
|
||||
Variant: endpoints.DualStackVariant,
|
||||
}: {
|
||||
Hostname: "textract.eu-central-1.api.aws",
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "eu-south-2",
|
||||
}: endpoints.Endpoint{},
|
||||
endpoints.EndpointKey{
|
||||
Region: "eu-south-2",
|
||||
Variant: endpoints.DualStackVariant,
|
||||
}: {
|
||||
Hostname: "textract.eu-south-2.api.aws",
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "eu-west-1",
|
||||
}: endpoints.Endpoint{},
|
||||
endpoints.EndpointKey{
|
||||
Region: "eu-west-1",
|
||||
Variant: endpoints.DualStackVariant,
|
||||
}: {
|
||||
Hostname: "textract.eu-west-1.api.aws",
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "eu-west-2",
|
||||
}: endpoints.Endpoint{},
|
||||
endpoints.EndpointKey{
|
||||
Region: "eu-west-2",
|
||||
Variant: endpoints.DualStackVariant,
|
||||
}: {
|
||||
Hostname: "textract.eu-west-2.api.aws",
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "eu-west-3",
|
||||
}: endpoints.Endpoint{},
|
||||
endpoints.EndpointKey{
|
||||
Region: "eu-west-3",
|
||||
Variant: endpoints.DualStackVariant,
|
||||
}: {
|
||||
Hostname: "textract.eu-west-3.api.aws",
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "fips-ca-central-1",
|
||||
}: endpoints.Endpoint{
|
||||
Hostname: "textract-fips.ca-central-1.amazonaws.com",
|
||||
CredentialScope: endpoints.CredentialScope{
|
||||
Region: "ca-central-1",
|
||||
},
|
||||
Deprecated: aws.TrueTernary,
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "fips-us-east-1",
|
||||
}: endpoints.Endpoint{
|
||||
Hostname: "textract-fips.us-east-1.amazonaws.com",
|
||||
CredentialScope: endpoints.CredentialScope{
|
||||
Region: "us-east-1",
|
||||
},
|
||||
Deprecated: aws.TrueTernary,
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "fips-us-east-2",
|
||||
}: endpoints.Endpoint{
|
||||
Hostname: "textract-fips.us-east-2.amazonaws.com",
|
||||
CredentialScope: endpoints.CredentialScope{
|
||||
Region: "us-east-2",
|
||||
},
|
||||
Deprecated: aws.TrueTernary,
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "fips-us-west-1",
|
||||
}: endpoints.Endpoint{
|
||||
Hostname: "textract-fips.us-west-1.amazonaws.com",
|
||||
CredentialScope: endpoints.CredentialScope{
|
||||
Region: "us-west-1",
|
||||
},
|
||||
Deprecated: aws.TrueTernary,
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "fips-us-west-2",
|
||||
}: endpoints.Endpoint{
|
||||
Hostname: "textract-fips.us-west-2.amazonaws.com",
|
||||
CredentialScope: endpoints.CredentialScope{
|
||||
Region: "us-west-2",
|
||||
},
|
||||
Deprecated: aws.TrueTernary,
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "us-east-1",
|
||||
}: endpoints.Endpoint{},
|
||||
endpoints.EndpointKey{
|
||||
Region: "us-east-1",
|
||||
Variant: endpoints.FIPSVariant,
|
||||
}: {
|
||||
Hostname: "textract-fips.us-east-1.amazonaws.com",
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "us-east-1",
|
||||
Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
|
||||
}: {
|
||||
Hostname: "textract-fips.us-east-1.api.aws",
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "us-east-1",
|
||||
Variant: endpoints.DualStackVariant,
|
||||
}: {
|
||||
Hostname: "textract.us-east-1.api.aws",
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "us-east-2",
|
||||
}: endpoints.Endpoint{},
|
||||
endpoints.EndpointKey{
|
||||
Region: "us-east-2",
|
||||
Variant: endpoints.FIPSVariant,
|
||||
}: {
|
||||
Hostname: "textract-fips.us-east-2.amazonaws.com",
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "us-east-2",
|
||||
Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
|
||||
}: {
|
||||
Hostname: "textract-fips.us-east-2.api.aws",
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "us-east-2",
|
||||
Variant: endpoints.DualStackVariant,
|
||||
}: {
|
||||
Hostname: "textract.us-east-2.api.aws",
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "us-west-1",
|
||||
}: endpoints.Endpoint{},
|
||||
endpoints.EndpointKey{
|
||||
Region: "us-west-1",
|
||||
Variant: endpoints.FIPSVariant,
|
||||
}: {
|
||||
Hostname: "textract-fips.us-west-1.amazonaws.com",
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "us-west-1",
|
||||
Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
|
||||
}: {
|
||||
Hostname: "textract-fips.us-west-1.api.aws",
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "us-west-1",
|
||||
Variant: endpoints.DualStackVariant,
|
||||
}: {
|
||||
Hostname: "textract.us-west-1.api.aws",
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "us-west-2",
|
||||
}: endpoints.Endpoint{},
|
||||
endpoints.EndpointKey{
|
||||
Region: "us-west-2",
|
||||
Variant: endpoints.FIPSVariant,
|
||||
}: {
|
||||
Hostname: "textract-fips.us-west-2.amazonaws.com",
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "us-west-2",
|
||||
Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
|
||||
}: {
|
||||
Hostname: "textract-fips.us-west-2.api.aws",
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "us-west-2",
|
||||
Variant: endpoints.DualStackVariant,
|
||||
}: {
|
||||
Hostname: "textract.us-west-2.api.aws",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
ID: "aws-cn",
|
||||
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
|
||||
{
|
||||
Variant: endpoints.DualStackVariant,
|
||||
}: {
|
||||
Hostname: "textract.{region}.api.amazonwebservices.com.cn",
|
||||
Protocols: []string{"https"},
|
||||
SignatureVersions: []string{"v4"},
|
||||
},
|
||||
{
|
||||
Variant: endpoints.FIPSVariant,
|
||||
}: {
|
||||
Hostname: "textract-fips.{region}.amazonaws.com.cn",
|
||||
Protocols: []string{"https"},
|
||||
SignatureVersions: []string{"v4"},
|
||||
},
|
||||
{
|
||||
Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
|
||||
}: {
|
||||
Hostname: "textract-fips.{region}.api.amazonwebservices.com.cn",
|
||||
Protocols: []string{"https"},
|
||||
SignatureVersions: []string{"v4"},
|
||||
},
|
||||
{
|
||||
Variant: 0,
|
||||
}: {
|
||||
Hostname: "textract.{region}.amazonaws.com.cn",
|
||||
Protocols: []string{"https"},
|
||||
SignatureVersions: []string{"v4"},
|
||||
},
|
||||
},
|
||||
RegionRegex: partitionRegexp.AwsCn,
|
||||
IsRegionalized: true,
|
||||
},
|
||||
{
|
||||
ID: "aws-iso",
|
||||
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
|
||||
{
|
||||
Variant: endpoints.FIPSVariant,
|
||||
}: {
|
||||
Hostname: "textract-fips.{region}.c2s.ic.gov",
|
||||
Protocols: []string{"https"},
|
||||
SignatureVersions: []string{"v4"},
|
||||
},
|
||||
{
|
||||
Variant: 0,
|
||||
}: {
|
||||
Hostname: "textract.{region}.c2s.ic.gov",
|
||||
Protocols: []string{"https"},
|
||||
SignatureVersions: []string{"v4"},
|
||||
},
|
||||
},
|
||||
RegionRegex: partitionRegexp.AwsIso,
|
||||
IsRegionalized: true,
|
||||
Endpoints: endpoints.Endpoints{
|
||||
endpoints.EndpointKey{
|
||||
Region: "us-iso-east-1",
|
||||
}: endpoints.Endpoint{},
|
||||
},
|
||||
},
|
||||
{
|
||||
ID: "aws-iso-b",
|
||||
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
|
||||
{
|
||||
Variant: endpoints.FIPSVariant,
|
||||
}: {
|
||||
Hostname: "textract-fips.{region}.sc2s.sgov.gov",
|
||||
Protocols: []string{"https"},
|
||||
SignatureVersions: []string{"v4"},
|
||||
},
|
||||
{
|
||||
Variant: 0,
|
||||
}: {
|
||||
Hostname: "textract.{region}.sc2s.sgov.gov",
|
||||
Protocols: []string{"https"},
|
||||
SignatureVersions: []string{"v4"},
|
||||
},
|
||||
},
|
||||
RegionRegex: partitionRegexp.AwsIsoB,
|
||||
IsRegionalized: true,
|
||||
},
|
||||
{
|
||||
ID: "aws-iso-e",
|
||||
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
|
||||
{
|
||||
Variant: endpoints.FIPSVariant,
|
||||
}: {
|
||||
Hostname: "textract-fips.{region}.cloud.adc-e.uk",
|
||||
Protocols: []string{"https"},
|
||||
SignatureVersions: []string{"v4"},
|
||||
},
|
||||
{
|
||||
Variant: 0,
|
||||
}: {
|
||||
Hostname: "textract.{region}.cloud.adc-e.uk",
|
||||
Protocols: []string{"https"},
|
||||
SignatureVersions: []string{"v4"},
|
||||
},
|
||||
},
|
||||
RegionRegex: partitionRegexp.AwsIsoE,
|
||||
IsRegionalized: true,
|
||||
},
|
||||
{
|
||||
ID: "aws-iso-f",
|
||||
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
|
||||
{
|
||||
Variant: endpoints.FIPSVariant,
|
||||
}: {
|
||||
Hostname: "textract-fips.{region}.csp.hci.ic.gov",
|
||||
Protocols: []string{"https"},
|
||||
SignatureVersions: []string{"v4"},
|
||||
},
|
||||
{
|
||||
Variant: 0,
|
||||
}: {
|
||||
Hostname: "textract.{region}.csp.hci.ic.gov",
|
||||
Protocols: []string{"https"},
|
||||
SignatureVersions: []string{"v4"},
|
||||
},
|
||||
},
|
||||
RegionRegex: partitionRegexp.AwsIsoF,
|
||||
IsRegionalized: true,
|
||||
Endpoints: endpoints.Endpoints{
|
||||
endpoints.EndpointKey{
|
||||
Region: "us-isof-east-1",
|
||||
}: endpoints.Endpoint{},
|
||||
endpoints.EndpointKey{
|
||||
Region: "us-isof-south-1",
|
||||
}: endpoints.Endpoint{},
|
||||
},
|
||||
},
|
||||
{
|
||||
ID: "aws-us-gov",
|
||||
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
|
||||
{
|
||||
Variant: endpoints.DualStackVariant,
|
||||
}: {
|
||||
Hostname: "textract.{region}.api.aws",
|
||||
Protocols: []string{"https"},
|
||||
SignatureVersions: []string{"v4"},
|
||||
},
|
||||
{
|
||||
Variant: endpoints.FIPSVariant,
|
||||
}: {
|
||||
Hostname: "textract-fips.{region}.amazonaws.com",
|
||||
Protocols: []string{"https"},
|
||||
SignatureVersions: []string{"v4"},
|
||||
},
|
||||
{
|
||||
Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
|
||||
}: {
|
||||
Hostname: "textract-fips.{region}.api.aws",
|
||||
Protocols: []string{"https"},
|
||||
SignatureVersions: []string{"v4"},
|
||||
},
|
||||
{
|
||||
Variant: 0,
|
||||
}: {
|
||||
Hostname: "textract.{region}.amazonaws.com",
|
||||
Protocols: []string{"https"},
|
||||
SignatureVersions: []string{"v4"},
|
||||
},
|
||||
},
|
||||
RegionRegex: partitionRegexp.AwsUsGov,
|
||||
IsRegionalized: true,
|
||||
Endpoints: endpoints.Endpoints{
|
||||
endpoints.EndpointKey{
|
||||
Region: "fips-us-gov-east-1",
|
||||
}: endpoints.Endpoint{
|
||||
Hostname: "textract-fips.us-gov-east-1.amazonaws.com",
|
||||
CredentialScope: endpoints.CredentialScope{
|
||||
Region: "us-gov-east-1",
|
||||
},
|
||||
Deprecated: aws.TrueTernary,
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "fips-us-gov-west-1",
|
||||
}: endpoints.Endpoint{
|
||||
Hostname: "textract-fips.us-gov-west-1.amazonaws.com",
|
||||
CredentialScope: endpoints.CredentialScope{
|
||||
Region: "us-gov-west-1",
|
||||
},
|
||||
Deprecated: aws.TrueTernary,
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "us-gov-east-1",
|
||||
}: endpoints.Endpoint{},
|
||||
endpoints.EndpointKey{
|
||||
Region: "us-gov-east-1",
|
||||
Variant: endpoints.FIPSVariant,
|
||||
}: {
|
||||
Hostname: "textract-fips.us-gov-east-1.amazonaws.com",
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "us-gov-east-1",
|
||||
Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
|
||||
}: {
|
||||
Hostname: "textract-fips.us-gov-east-1.api.aws",
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "us-gov-east-1",
|
||||
Variant: endpoints.DualStackVariant,
|
||||
}: {
|
||||
Hostname: "textract.us-gov-east-1.api.aws",
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "us-gov-west-1",
|
||||
}: endpoints.Endpoint{},
|
||||
endpoints.EndpointKey{
|
||||
Region: "us-gov-west-1",
|
||||
Variant: endpoints.FIPSVariant,
|
||||
}: {
|
||||
Hostname: "textract-fips.us-gov-west-1.amazonaws.com",
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "us-gov-west-1",
|
||||
Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
|
||||
}: {
|
||||
Hostname: "textract-fips.us-gov-west-1.api.aws",
|
||||
},
|
||||
endpoints.EndpointKey{
|
||||
Region: "us-gov-west-1",
|
||||
Variant: endpoints.DualStackVariant,
|
||||
}: {
|
||||
Hostname: "textract.us-gov-west-1.api.aws",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
+236
@@ -0,0 +1,236 @@
|
||||
// Code generated by smithy-go-codegen DO NOT EDIT.
|
||||
|
||||
package textract
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/aws/aws-sdk-go-v2/aws"
|
||||
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
|
||||
internalauthsmithy "github.com/aws/aws-sdk-go-v2/internal/auth/smithy"
|
||||
smithyauth "github.com/aws/smithy-go/auth"
|
||||
"github.com/aws/smithy-go/logging"
|
||||
"github.com/aws/smithy-go/metrics"
|
||||
"github.com/aws/smithy-go/middleware"
|
||||
"github.com/aws/smithy-go/tracing"
|
||||
smithyhttp "github.com/aws/smithy-go/transport/http"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type HTTPClient interface {
|
||||
Do(*http.Request) (*http.Response, error)
|
||||
}
|
||||
|
||||
type Options struct {
|
||||
// Set of options to modify how an operation is invoked. These apply to all
|
||||
// operations invoked for this client. Use functional options on operation call to
|
||||
// modify this list for per operation behavior.
|
||||
APIOptions []func(*middleware.Stack) error
|
||||
|
||||
// The optional application specific identifier appended to the User-Agent header.
|
||||
AppID string
|
||||
|
||||
// This endpoint will be given as input to an EndpointResolverV2. It is used for
|
||||
// providing a custom base endpoint that is subject to modifications by the
|
||||
// processing EndpointResolverV2.
|
||||
BaseEndpoint *string
|
||||
|
||||
// Configures the events that will be sent to the configured logger.
|
||||
ClientLogMode aws.ClientLogMode
|
||||
|
||||
// The credentials object to use when signing requests.
|
||||
Credentials aws.CredentialsProvider
|
||||
|
||||
// The configuration DefaultsMode that the SDK should use when constructing the
|
||||
// clients initial default settings.
|
||||
DefaultsMode aws.DefaultsMode
|
||||
|
||||
// The endpoint options to be used when attempting to resolve an endpoint.
|
||||
EndpointOptions EndpointResolverOptions
|
||||
|
||||
// The service endpoint resolver.
|
||||
//
|
||||
// Deprecated: Deprecated: EndpointResolver and WithEndpointResolver. Providing a
|
||||
// value for this field will likely prevent you from using any endpoint-related
|
||||
// service features released after the introduction of EndpointResolverV2 and
|
||||
// BaseEndpoint.
|
||||
//
|
||||
// To migrate an EndpointResolver implementation that uses a custom endpoint, set
|
||||
// the client option BaseEndpoint instead.
|
||||
EndpointResolver EndpointResolver
|
||||
|
||||
// Resolves the endpoint used for a particular service operation. This should be
|
||||
// used over the deprecated EndpointResolver.
|
||||
EndpointResolverV2 EndpointResolverV2
|
||||
|
||||
// Signature Version 4 (SigV4) Signer
|
||||
HTTPSignerV4 HTTPSignerV4
|
||||
|
||||
// Provides idempotency tokens values that will be automatically populated into
|
||||
// idempotent API operations.
|
||||
IdempotencyTokenProvider IdempotencyTokenProvider
|
||||
|
||||
// The logger writer interface to write logging messages to.
|
||||
Logger logging.Logger
|
||||
|
||||
// The client meter provider.
|
||||
MeterProvider metrics.MeterProvider
|
||||
|
||||
// The region to send requests to. (Required)
|
||||
Region string
|
||||
|
||||
// RetryMaxAttempts specifies the maximum number attempts an API client will call
|
||||
// an operation that fails with a retryable error. A value of 0 is ignored, and
|
||||
// will not be used to configure the API client created default retryer, or modify
|
||||
// per operation call's retry max attempts.
|
||||
//
|
||||
// If specified in an operation call's functional options with a value that is
|
||||
// different than the constructed client's Options, the Client's Retryer will be
|
||||
// wrapped to use the operation's specific RetryMaxAttempts value.
|
||||
RetryMaxAttempts int
|
||||
|
||||
// RetryMode specifies the retry mode the API client will be created with, if
|
||||
// Retryer option is not also specified.
|
||||
//
|
||||
// When creating a new API Clients this member will only be used if the Retryer
|
||||
// Options member is nil. This value will be ignored if Retryer is not nil.
|
||||
//
|
||||
// Currently does not support per operation call overrides, may in the future.
|
||||
RetryMode aws.RetryMode
|
||||
|
||||
// Retryer guides how HTTP requests should be retried in case of recoverable
|
||||
// failures. When nil the API client will use a default retryer. The kind of
|
||||
// default retry created by the API client can be changed with the RetryMode
|
||||
// option.
|
||||
Retryer aws.Retryer
|
||||
|
||||
// The RuntimeEnvironment configuration, only populated if the DefaultsMode is set
|
||||
// to DefaultsModeAuto and is initialized using config.LoadDefaultConfig . You
|
||||
// should not populate this structure programmatically, or rely on the values here
|
||||
// within your applications.
|
||||
RuntimeEnvironment aws.RuntimeEnvironment
|
||||
|
||||
// The client tracer provider.
|
||||
TracerProvider tracing.TracerProvider
|
||||
|
||||
// The initial DefaultsMode used when the client options were constructed. If the
|
||||
// DefaultsMode was set to aws.DefaultsModeAuto this will store what the resolved
|
||||
// value was at that point in time.
|
||||
//
|
||||
// Currently does not support per operation call overrides, may in the future.
|
||||
resolvedDefaultsMode aws.DefaultsMode
|
||||
|
||||
// The HTTP client to invoke API calls with. Defaults to client's default HTTP
|
||||
// implementation if nil.
|
||||
HTTPClient HTTPClient
|
||||
|
||||
// The auth scheme resolver which determines how to authenticate for each
|
||||
// operation.
|
||||
AuthSchemeResolver AuthSchemeResolver
|
||||
|
||||
// The list of auth schemes supported by the client.
|
||||
AuthSchemes []smithyhttp.AuthScheme
|
||||
}
|
||||
|
||||
// Copy creates a clone where the APIOptions list is deep copied.
|
||||
func (o Options) Copy() Options {
|
||||
to := o
|
||||
to.APIOptions = make([]func(*middleware.Stack) error, len(o.APIOptions))
|
||||
copy(to.APIOptions, o.APIOptions)
|
||||
|
||||
return to
|
||||
}
|
||||
|
||||
func (o Options) GetIdentityResolver(schemeID string) smithyauth.IdentityResolver {
|
||||
if schemeID == "aws.auth#sigv4" {
|
||||
return getSigV4IdentityResolver(o)
|
||||
}
|
||||
if schemeID == "smithy.api#noAuth" {
|
||||
return &smithyauth.AnonymousIdentityResolver{}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// WithAPIOptions returns a functional option for setting the Client's APIOptions
|
||||
// option.
|
||||
func WithAPIOptions(optFns ...func(*middleware.Stack) error) func(*Options) {
|
||||
return func(o *Options) {
|
||||
o.APIOptions = append(o.APIOptions, optFns...)
|
||||
}
|
||||
}
|
||||
|
||||
// Deprecated: EndpointResolver and WithEndpointResolver. Providing a value for
|
||||
// this field will likely prevent you from using any endpoint-related service
|
||||
// features released after the introduction of EndpointResolverV2 and BaseEndpoint.
|
||||
//
|
||||
// To migrate an EndpointResolver implementation that uses a custom endpoint, set
|
||||
// the client option BaseEndpoint instead.
|
||||
func WithEndpointResolver(v EndpointResolver) func(*Options) {
|
||||
return func(o *Options) {
|
||||
o.EndpointResolver = v
|
||||
}
|
||||
}
|
||||
|
||||
// WithEndpointResolverV2 returns a functional option for setting the Client's
|
||||
// EndpointResolverV2 option.
|
||||
func WithEndpointResolverV2(v EndpointResolverV2) func(*Options) {
|
||||
return func(o *Options) {
|
||||
o.EndpointResolverV2 = v
|
||||
}
|
||||
}
|
||||
|
||||
func getSigV4IdentityResolver(o Options) smithyauth.IdentityResolver {
|
||||
if o.Credentials != nil {
|
||||
return &internalauthsmithy.CredentialsProviderAdapter{Provider: o.Credentials}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// WithSigV4SigningName applies an override to the authentication workflow to
|
||||
// use the given signing name for SigV4-authenticated operations.
|
||||
//
|
||||
// This is an advanced setting. The value here is FINAL, taking precedence over
|
||||
// the resolved signing name from both auth scheme resolution and endpoint
|
||||
// resolution.
|
||||
func WithSigV4SigningName(name string) func(*Options) {
|
||||
fn := func(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
|
||||
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
|
||||
) {
|
||||
return next.HandleInitialize(awsmiddleware.SetSigningName(ctx, name), in)
|
||||
}
|
||||
return func(o *Options) {
|
||||
o.APIOptions = append(o.APIOptions, func(s *middleware.Stack) error {
|
||||
return s.Initialize.Add(
|
||||
middleware.InitializeMiddlewareFunc("withSigV4SigningName", fn),
|
||||
middleware.Before,
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// WithSigV4SigningRegion applies an override to the authentication workflow to
|
||||
// use the given signing region for SigV4-authenticated operations.
|
||||
//
|
||||
// This is an advanced setting. The value here is FINAL, taking precedence over
|
||||
// the resolved signing region from both auth scheme resolution and endpoint
|
||||
// resolution.
|
||||
func WithSigV4SigningRegion(region string) func(*Options) {
|
||||
fn := func(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
|
||||
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
|
||||
) {
|
||||
return next.HandleInitialize(awsmiddleware.SetSigningRegion(ctx, region), in)
|
||||
}
|
||||
return func(o *Options) {
|
||||
o.APIOptions = append(o.APIOptions, func(s *middleware.Stack) error {
|
||||
return s.Initialize.Add(
|
||||
middleware.InitializeMiddlewareFunc("withSigV4SigningRegion", fn),
|
||||
middleware.Before,
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func ignoreAnonymousAuth(options *Options) {
|
||||
if aws.IsCredentialsProvider(options.Credentials, (*aws.AnonymousCredentials)(nil)) {
|
||||
options.Credentials = nil
|
||||
}
|
||||
}
|
||||
+2519
File diff suppressed because it is too large
Load Diff
+298
@@ -0,0 +1,298 @@
|
||||
// Code generated by smithy-go-codegen DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
type AdapterVersionStatus string
|
||||
|
||||
// Enum values for AdapterVersionStatus
|
||||
const (
|
||||
AdapterVersionStatusActive AdapterVersionStatus = "ACTIVE"
|
||||
AdapterVersionStatusAtRisk AdapterVersionStatus = "AT_RISK"
|
||||
AdapterVersionStatusDeprecated AdapterVersionStatus = "DEPRECATED"
|
||||
AdapterVersionStatusCreationError AdapterVersionStatus = "CREATION_ERROR"
|
||||
AdapterVersionStatusCreationInProgress AdapterVersionStatus = "CREATION_IN_PROGRESS"
|
||||
)
|
||||
|
||||
// Values returns all known values for AdapterVersionStatus. 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 (AdapterVersionStatus) Values() []AdapterVersionStatus {
|
||||
return []AdapterVersionStatus{
|
||||
"ACTIVE",
|
||||
"AT_RISK",
|
||||
"DEPRECATED",
|
||||
"CREATION_ERROR",
|
||||
"CREATION_IN_PROGRESS",
|
||||
}
|
||||
}
|
||||
|
||||
type AutoUpdate string
|
||||
|
||||
// Enum values for AutoUpdate
|
||||
const (
|
||||
AutoUpdateEnabled AutoUpdate = "ENABLED"
|
||||
AutoUpdateDisabled AutoUpdate = "DISABLED"
|
||||
)
|
||||
|
||||
// Values returns all known values for AutoUpdate. 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 (AutoUpdate) Values() []AutoUpdate {
|
||||
return []AutoUpdate{
|
||||
"ENABLED",
|
||||
"DISABLED",
|
||||
}
|
||||
}
|
||||
|
||||
type BlockType string
|
||||
|
||||
// Enum values for BlockType
|
||||
const (
|
||||
BlockTypeKeyValueSet BlockType = "KEY_VALUE_SET"
|
||||
BlockTypePage BlockType = "PAGE"
|
||||
BlockTypeLine BlockType = "LINE"
|
||||
BlockTypeWord BlockType = "WORD"
|
||||
BlockTypeTable BlockType = "TABLE"
|
||||
BlockTypeCell BlockType = "CELL"
|
||||
BlockTypeSelectionElement BlockType = "SELECTION_ELEMENT"
|
||||
BlockTypeMergedCell BlockType = "MERGED_CELL"
|
||||
BlockTypeTitle BlockType = "TITLE"
|
||||
BlockTypeQuery BlockType = "QUERY"
|
||||
BlockTypeQueryResult BlockType = "QUERY_RESULT"
|
||||
BlockTypeSignature BlockType = "SIGNATURE"
|
||||
BlockTypeTableTitle BlockType = "TABLE_TITLE"
|
||||
BlockTypeTableFooter BlockType = "TABLE_FOOTER"
|
||||
BlockTypeLayoutText BlockType = "LAYOUT_TEXT"
|
||||
BlockTypeLayoutTitle BlockType = "LAYOUT_TITLE"
|
||||
BlockTypeLayoutHeader BlockType = "LAYOUT_HEADER"
|
||||
BlockTypeLayoutFooter BlockType = "LAYOUT_FOOTER"
|
||||
BlockTypeLayoutSectionHeader BlockType = "LAYOUT_SECTION_HEADER"
|
||||
BlockTypeLayoutPageNumber BlockType = "LAYOUT_PAGE_NUMBER"
|
||||
BlockTypeLayoutList BlockType = "LAYOUT_LIST"
|
||||
BlockTypeLayoutFigure BlockType = "LAYOUT_FIGURE"
|
||||
BlockTypeLayoutTable BlockType = "LAYOUT_TABLE"
|
||||
BlockTypeLayoutKeyValue BlockType = "LAYOUT_KEY_VALUE"
|
||||
)
|
||||
|
||||
// Values returns all known values for BlockType. 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 (BlockType) Values() []BlockType {
|
||||
return []BlockType{
|
||||
"KEY_VALUE_SET",
|
||||
"PAGE",
|
||||
"LINE",
|
||||
"WORD",
|
||||
"TABLE",
|
||||
"CELL",
|
||||
"SELECTION_ELEMENT",
|
||||
"MERGED_CELL",
|
||||
"TITLE",
|
||||
"QUERY",
|
||||
"QUERY_RESULT",
|
||||
"SIGNATURE",
|
||||
"TABLE_TITLE",
|
||||
"TABLE_FOOTER",
|
||||
"LAYOUT_TEXT",
|
||||
"LAYOUT_TITLE",
|
||||
"LAYOUT_HEADER",
|
||||
"LAYOUT_FOOTER",
|
||||
"LAYOUT_SECTION_HEADER",
|
||||
"LAYOUT_PAGE_NUMBER",
|
||||
"LAYOUT_LIST",
|
||||
"LAYOUT_FIGURE",
|
||||
"LAYOUT_TABLE",
|
||||
"LAYOUT_KEY_VALUE",
|
||||
}
|
||||
}
|
||||
|
||||
type ContentClassifier string
|
||||
|
||||
// Enum values for ContentClassifier
|
||||
const (
|
||||
ContentClassifierFreeOfPersonallyIdentifiableInformation ContentClassifier = "FreeOfPersonallyIdentifiableInformation"
|
||||
ContentClassifierFreeOfAdultContent ContentClassifier = "FreeOfAdultContent"
|
||||
)
|
||||
|
||||
// Values returns all known values for ContentClassifier. 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 (ContentClassifier) Values() []ContentClassifier {
|
||||
return []ContentClassifier{
|
||||
"FreeOfPersonallyIdentifiableInformation",
|
||||
"FreeOfAdultContent",
|
||||
}
|
||||
}
|
||||
|
||||
type EntityType string
|
||||
|
||||
// Enum values for EntityType
|
||||
const (
|
||||
EntityTypeKey EntityType = "KEY"
|
||||
EntityTypeValue EntityType = "VALUE"
|
||||
EntityTypeColumnHeader EntityType = "COLUMN_HEADER"
|
||||
EntityTypeTableTitle EntityType = "TABLE_TITLE"
|
||||
EntityTypeTableFooter EntityType = "TABLE_FOOTER"
|
||||
EntityTypeTableSectionTitle EntityType = "TABLE_SECTION_TITLE"
|
||||
EntityTypeTableSummary EntityType = "TABLE_SUMMARY"
|
||||
EntityTypeStructuredTable EntityType = "STRUCTURED_TABLE"
|
||||
EntityTypeSemiStructuredTable EntityType = "SEMI_STRUCTURED_TABLE"
|
||||
)
|
||||
|
||||
// Values returns all known values for EntityType. 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 (EntityType) Values() []EntityType {
|
||||
return []EntityType{
|
||||
"KEY",
|
||||
"VALUE",
|
||||
"COLUMN_HEADER",
|
||||
"TABLE_TITLE",
|
||||
"TABLE_FOOTER",
|
||||
"TABLE_SECTION_TITLE",
|
||||
"TABLE_SUMMARY",
|
||||
"STRUCTURED_TABLE",
|
||||
"SEMI_STRUCTURED_TABLE",
|
||||
}
|
||||
}
|
||||
|
||||
type FeatureType string
|
||||
|
||||
// Enum values for FeatureType
|
||||
const (
|
||||
FeatureTypeTables FeatureType = "TABLES"
|
||||
FeatureTypeForms FeatureType = "FORMS"
|
||||
FeatureTypeQueries FeatureType = "QUERIES"
|
||||
FeatureTypeSignatures FeatureType = "SIGNATURES"
|
||||
FeatureTypeLayout FeatureType = "LAYOUT"
|
||||
)
|
||||
|
||||
// Values returns all known values for FeatureType. 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 (FeatureType) Values() []FeatureType {
|
||||
return []FeatureType{
|
||||
"TABLES",
|
||||
"FORMS",
|
||||
"QUERIES",
|
||||
"SIGNATURES",
|
||||
"LAYOUT",
|
||||
}
|
||||
}
|
||||
|
||||
type JobStatus string
|
||||
|
||||
// Enum values for JobStatus
|
||||
const (
|
||||
JobStatusInProgress JobStatus = "IN_PROGRESS"
|
||||
JobStatusSucceeded JobStatus = "SUCCEEDED"
|
||||
JobStatusFailed JobStatus = "FAILED"
|
||||
JobStatusPartialSuccess JobStatus = "PARTIAL_SUCCESS"
|
||||
)
|
||||
|
||||
// Values returns all known values for JobStatus. 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 (JobStatus) Values() []JobStatus {
|
||||
return []JobStatus{
|
||||
"IN_PROGRESS",
|
||||
"SUCCEEDED",
|
||||
"FAILED",
|
||||
"PARTIAL_SUCCESS",
|
||||
}
|
||||
}
|
||||
|
||||
type RelationshipType string
|
||||
|
||||
// Enum values for RelationshipType
|
||||
const (
|
||||
RelationshipTypeValue RelationshipType = "VALUE"
|
||||
RelationshipTypeChild RelationshipType = "CHILD"
|
||||
RelationshipTypeComplexFeatures RelationshipType = "COMPLEX_FEATURES"
|
||||
RelationshipTypeMergedCell RelationshipType = "MERGED_CELL"
|
||||
RelationshipTypeTitle RelationshipType = "TITLE"
|
||||
RelationshipTypeAnswer RelationshipType = "ANSWER"
|
||||
RelationshipTypeTable RelationshipType = "TABLE"
|
||||
RelationshipTypeTableTitle RelationshipType = "TABLE_TITLE"
|
||||
RelationshipTypeTableFooter RelationshipType = "TABLE_FOOTER"
|
||||
)
|
||||
|
||||
// Values returns all known values for RelationshipType. 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 (RelationshipType) Values() []RelationshipType {
|
||||
return []RelationshipType{
|
||||
"VALUE",
|
||||
"CHILD",
|
||||
"COMPLEX_FEATURES",
|
||||
"MERGED_CELL",
|
||||
"TITLE",
|
||||
"ANSWER",
|
||||
"TABLE",
|
||||
"TABLE_TITLE",
|
||||
"TABLE_FOOTER",
|
||||
}
|
||||
}
|
||||
|
||||
type SelectionStatus string
|
||||
|
||||
// Enum values for SelectionStatus
|
||||
const (
|
||||
SelectionStatusSelected SelectionStatus = "SELECTED"
|
||||
SelectionStatusNotSelected SelectionStatus = "NOT_SELECTED"
|
||||
)
|
||||
|
||||
// Values returns all known values for SelectionStatus. 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 (SelectionStatus) Values() []SelectionStatus {
|
||||
return []SelectionStatus{
|
||||
"SELECTED",
|
||||
"NOT_SELECTED",
|
||||
}
|
||||
}
|
||||
|
||||
type TextType string
|
||||
|
||||
// Enum values for TextType
|
||||
const (
|
||||
TextTypeHandwriting TextType = "HANDWRITING"
|
||||
TextTypePrinted TextType = "PRINTED"
|
||||
)
|
||||
|
||||
// Values returns all known values for TextType. 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 (TextType) Values() []TextType {
|
||||
return []TextType{
|
||||
"HANDWRITING",
|
||||
"PRINTED",
|
||||
}
|
||||
}
|
||||
|
||||
type ValueType string
|
||||
|
||||
// Enum values for ValueType
|
||||
const (
|
||||
ValueTypeDate ValueType = "DATE"
|
||||
)
|
||||
|
||||
// Values returns all known values for ValueType. 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 (ValueType) Values() []ValueType {
|
||||
return []ValueType{
|
||||
"DATE",
|
||||
}
|
||||
}
|
||||
+543
@@ -0,0 +1,543 @@
|
||||
// Code generated by smithy-go-codegen DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
smithy "github.com/aws/smithy-go"
|
||||
)
|
||||
|
||||
// You aren't authorized to perform the action. Use the Amazon Resource Name (ARN)
|
||||
// of an authorized user or IAM role to perform the operation.
|
||||
type AccessDeniedException struct {
|
||||
Message *string
|
||||
|
||||
ErrorCodeOverride *string
|
||||
|
||||
Code *string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (e *AccessDeniedException) Error() string {
|
||||
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
|
||||
}
|
||||
func (e *AccessDeniedException) ErrorMessage() string {
|
||||
if e.Message == nil {
|
||||
return ""
|
||||
}
|
||||
return *e.Message
|
||||
}
|
||||
func (e *AccessDeniedException) ErrorCode() string {
|
||||
if e == nil || e.ErrorCodeOverride == nil {
|
||||
return "AccessDeniedException"
|
||||
}
|
||||
return *e.ErrorCodeOverride
|
||||
}
|
||||
func (e *AccessDeniedException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
|
||||
|
||||
// Amazon Textract isn't able to read the document. For more information on the
|
||||
// document limits in Amazon Textract, see limits.
|
||||
type BadDocumentException struct {
|
||||
Message *string
|
||||
|
||||
ErrorCodeOverride *string
|
||||
|
||||
Code *string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (e *BadDocumentException) Error() string {
|
||||
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
|
||||
}
|
||||
func (e *BadDocumentException) ErrorMessage() string {
|
||||
if e.Message == nil {
|
||||
return ""
|
||||
}
|
||||
return *e.Message
|
||||
}
|
||||
func (e *BadDocumentException) ErrorCode() string {
|
||||
if e == nil || e.ErrorCodeOverride == nil {
|
||||
return "BadDocumentException"
|
||||
}
|
||||
return *e.ErrorCodeOverride
|
||||
}
|
||||
func (e *BadDocumentException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
|
||||
|
||||
// Updating or deleting a resource can cause an inconsistent state.
|
||||
type ConflictException struct {
|
||||
Message *string
|
||||
|
||||
ErrorCodeOverride *string
|
||||
|
||||
Code *string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (e *ConflictException) Error() string {
|
||||
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
|
||||
}
|
||||
func (e *ConflictException) ErrorMessage() string {
|
||||
if e.Message == nil {
|
||||
return ""
|
||||
}
|
||||
return *e.Message
|
||||
}
|
||||
func (e *ConflictException) ErrorCode() string {
|
||||
if e == nil || e.ErrorCodeOverride == nil {
|
||||
return "ConflictException"
|
||||
}
|
||||
return *e.ErrorCodeOverride
|
||||
}
|
||||
func (e *ConflictException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
|
||||
|
||||
// The document can't be processed because it's too large. The maximum document
|
||||
// size for synchronous operations 10 MB. The maximum document size for
|
||||
// asynchronous operations is 500 MB for PDF files.
|
||||
type DocumentTooLargeException struct {
|
||||
Message *string
|
||||
|
||||
ErrorCodeOverride *string
|
||||
|
||||
Code *string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (e *DocumentTooLargeException) Error() string {
|
||||
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
|
||||
}
|
||||
func (e *DocumentTooLargeException) ErrorMessage() string {
|
||||
if e.Message == nil {
|
||||
return ""
|
||||
}
|
||||
return *e.Message
|
||||
}
|
||||
func (e *DocumentTooLargeException) ErrorCode() string {
|
||||
if e == nil || e.ErrorCodeOverride == nil {
|
||||
return "DocumentTooLargeException"
|
||||
}
|
||||
return *e.ErrorCodeOverride
|
||||
}
|
||||
func (e *DocumentTooLargeException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
|
||||
|
||||
// Indicates you have exceeded the maximum number of active human in the loop
|
||||
// workflows available
|
||||
type HumanLoopQuotaExceededException struct {
|
||||
Message *string
|
||||
|
||||
ErrorCodeOverride *string
|
||||
|
||||
ResourceType *string
|
||||
QuotaCode *string
|
||||
ServiceCode *string
|
||||
Code *string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (e *HumanLoopQuotaExceededException) Error() string {
|
||||
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
|
||||
}
|
||||
func (e *HumanLoopQuotaExceededException) ErrorMessage() string {
|
||||
if e.Message == nil {
|
||||
return ""
|
||||
}
|
||||
return *e.Message
|
||||
}
|
||||
func (e *HumanLoopQuotaExceededException) ErrorCode() string {
|
||||
if e == nil || e.ErrorCodeOverride == nil {
|
||||
return "HumanLoopQuotaExceededException"
|
||||
}
|
||||
return *e.ErrorCodeOverride
|
||||
}
|
||||
func (e *HumanLoopQuotaExceededException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
|
||||
|
||||
// A ClientRequestToken input parameter was reused with an operation, but at least
|
||||
// one of the other input parameters is different from the previous call to the
|
||||
// operation.
|
||||
type IdempotentParameterMismatchException struct {
|
||||
Message *string
|
||||
|
||||
ErrorCodeOverride *string
|
||||
|
||||
Code *string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (e *IdempotentParameterMismatchException) Error() string {
|
||||
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
|
||||
}
|
||||
func (e *IdempotentParameterMismatchException) ErrorMessage() string {
|
||||
if e.Message == nil {
|
||||
return ""
|
||||
}
|
||||
return *e.Message
|
||||
}
|
||||
func (e *IdempotentParameterMismatchException) ErrorCode() string {
|
||||
if e == nil || e.ErrorCodeOverride == nil {
|
||||
return "IdempotentParameterMismatchException"
|
||||
}
|
||||
return *e.ErrorCodeOverride
|
||||
}
|
||||
func (e *IdempotentParameterMismatchException) ErrorFault() smithy.ErrorFault {
|
||||
return smithy.FaultClient
|
||||
}
|
||||
|
||||
// Amazon Textract experienced a service issue. Try your call again.
|
||||
type InternalServerError struct {
|
||||
Message *string
|
||||
|
||||
ErrorCodeOverride *string
|
||||
|
||||
Code *string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (e *InternalServerError) Error() string {
|
||||
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
|
||||
}
|
||||
func (e *InternalServerError) ErrorMessage() string {
|
||||
if e.Message == nil {
|
||||
return ""
|
||||
}
|
||||
return *e.Message
|
||||
}
|
||||
func (e *InternalServerError) ErrorCode() string {
|
||||
if e == nil || e.ErrorCodeOverride == nil {
|
||||
return "InternalServerError"
|
||||
}
|
||||
return *e.ErrorCodeOverride
|
||||
}
|
||||
func (e *InternalServerError) ErrorFault() smithy.ErrorFault { return smithy.FaultServer }
|
||||
|
||||
// An invalid job identifier was passed to an asynchronous analysis operation.
|
||||
type InvalidJobIdException struct {
|
||||
Message *string
|
||||
|
||||
ErrorCodeOverride *string
|
||||
|
||||
Code *string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (e *InvalidJobIdException) Error() string {
|
||||
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
|
||||
}
|
||||
func (e *InvalidJobIdException) ErrorMessage() string {
|
||||
if e.Message == nil {
|
||||
return ""
|
||||
}
|
||||
return *e.Message
|
||||
}
|
||||
func (e *InvalidJobIdException) ErrorCode() string {
|
||||
if e == nil || e.ErrorCodeOverride == nil {
|
||||
return "InvalidJobIdException"
|
||||
}
|
||||
return *e.ErrorCodeOverride
|
||||
}
|
||||
func (e *InvalidJobIdException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
|
||||
|
||||
// Indicates you do not have decrypt permissions with the KMS key entered, or the
|
||||
//
|
||||
// KMS key was entered incorrectly.
|
||||
type InvalidKMSKeyException struct {
|
||||
Message *string
|
||||
|
||||
ErrorCodeOverride *string
|
||||
|
||||
Code *string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (e *InvalidKMSKeyException) Error() string {
|
||||
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
|
||||
}
|
||||
func (e *InvalidKMSKeyException) ErrorMessage() string {
|
||||
if e.Message == nil {
|
||||
return ""
|
||||
}
|
||||
return *e.Message
|
||||
}
|
||||
func (e *InvalidKMSKeyException) ErrorCode() string {
|
||||
if e == nil || e.ErrorCodeOverride == nil {
|
||||
return "InvalidKMSKeyException"
|
||||
}
|
||||
return *e.ErrorCodeOverride
|
||||
}
|
||||
func (e *InvalidKMSKeyException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
|
||||
|
||||
// An input parameter violated a constraint. For example, in synchronous
|
||||
// operations, an InvalidParameterException exception occurs when neither of the
|
||||
// S3Object or Bytes values are supplied in the Document request parameter.
|
||||
// Validate your parameter before calling the API operation again.
|
||||
type InvalidParameterException struct {
|
||||
Message *string
|
||||
|
||||
ErrorCodeOverride *string
|
||||
|
||||
Code *string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (e *InvalidParameterException) Error() string {
|
||||
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
|
||||
}
|
||||
func (e *InvalidParameterException) ErrorMessage() string {
|
||||
if e.Message == nil {
|
||||
return ""
|
||||
}
|
||||
return *e.Message
|
||||
}
|
||||
func (e *InvalidParameterException) ErrorCode() string {
|
||||
if e == nil || e.ErrorCodeOverride == nil {
|
||||
return "InvalidParameterException"
|
||||
}
|
||||
return *e.ErrorCodeOverride
|
||||
}
|
||||
func (e *InvalidParameterException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
|
||||
|
||||
// Amazon Textract is unable to access the S3 object that's specified in the
|
||||
// request. for more information, [Configure Access to Amazon S3]For troubleshooting information, see [Troubleshooting Amazon S3]
|
||||
//
|
||||
// [Troubleshooting Amazon S3]: https://docs.aws.amazon.com/AmazonS3/latest/dev/troubleshooting.html
|
||||
// [Configure Access to Amazon S3]: https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html
|
||||
type InvalidS3ObjectException struct {
|
||||
Message *string
|
||||
|
||||
ErrorCodeOverride *string
|
||||
|
||||
Code *string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (e *InvalidS3ObjectException) Error() string {
|
||||
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
|
||||
}
|
||||
func (e *InvalidS3ObjectException) ErrorMessage() string {
|
||||
if e.Message == nil {
|
||||
return ""
|
||||
}
|
||||
return *e.Message
|
||||
}
|
||||
func (e *InvalidS3ObjectException) ErrorCode() string {
|
||||
if e == nil || e.ErrorCodeOverride == nil {
|
||||
return "InvalidS3ObjectException"
|
||||
}
|
||||
return *e.ErrorCodeOverride
|
||||
}
|
||||
func (e *InvalidS3ObjectException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
|
||||
|
||||
// An Amazon Textract service limit was exceeded. For example, if you start too
|
||||
// many asynchronous jobs concurrently, calls to start operations (
|
||||
// StartDocumentTextDetection , for example) raise a LimitExceededException
|
||||
// exception (HTTP status code: 400) until the number of concurrently running jobs
|
||||
// is below the Amazon Textract service limit.
|
||||
type LimitExceededException struct {
|
||||
Message *string
|
||||
|
||||
ErrorCodeOverride *string
|
||||
|
||||
Code *string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (e *LimitExceededException) Error() string {
|
||||
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
|
||||
}
|
||||
func (e *LimitExceededException) ErrorMessage() string {
|
||||
if e.Message == nil {
|
||||
return ""
|
||||
}
|
||||
return *e.Message
|
||||
}
|
||||
func (e *LimitExceededException) ErrorCode() string {
|
||||
if e == nil || e.ErrorCodeOverride == nil {
|
||||
return "LimitExceededException"
|
||||
}
|
||||
return *e.ErrorCodeOverride
|
||||
}
|
||||
func (e *LimitExceededException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
|
||||
|
||||
// The number of requests exceeded your throughput limit. If you want to increase
|
||||
// this limit, contact Amazon Textract.
|
||||
type ProvisionedThroughputExceededException struct {
|
||||
Message *string
|
||||
|
||||
ErrorCodeOverride *string
|
||||
|
||||
Code *string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (e *ProvisionedThroughputExceededException) Error() string {
|
||||
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
|
||||
}
|
||||
func (e *ProvisionedThroughputExceededException) ErrorMessage() string {
|
||||
if e.Message == nil {
|
||||
return ""
|
||||
}
|
||||
return *e.Message
|
||||
}
|
||||
func (e *ProvisionedThroughputExceededException) ErrorCode() string {
|
||||
if e == nil || e.ErrorCodeOverride == nil {
|
||||
return "ProvisionedThroughputExceededException"
|
||||
}
|
||||
return *e.ErrorCodeOverride
|
||||
}
|
||||
func (e *ProvisionedThroughputExceededException) ErrorFault() smithy.ErrorFault {
|
||||
return smithy.FaultClient
|
||||
}
|
||||
|
||||
// Returned when an operation tried to access a nonexistent resource.
|
||||
type ResourceNotFoundException struct {
|
||||
Message *string
|
||||
|
||||
ErrorCodeOverride *string
|
||||
|
||||
Code *string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (e *ResourceNotFoundException) Error() string {
|
||||
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
|
||||
}
|
||||
func (e *ResourceNotFoundException) ErrorMessage() string {
|
||||
if e.Message == nil {
|
||||
return ""
|
||||
}
|
||||
return *e.Message
|
||||
}
|
||||
func (e *ResourceNotFoundException) ErrorCode() string {
|
||||
if e == nil || e.ErrorCodeOverride == nil {
|
||||
return "ResourceNotFoundException"
|
||||
}
|
||||
return *e.ErrorCodeOverride
|
||||
}
|
||||
func (e *ResourceNotFoundException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
|
||||
|
||||
// Returned when a request cannot be completed as it would exceed a maximum
|
||||
// service quota.
|
||||
type ServiceQuotaExceededException struct {
|
||||
Message *string
|
||||
|
||||
ErrorCodeOverride *string
|
||||
|
||||
Code *string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (e *ServiceQuotaExceededException) Error() string {
|
||||
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
|
||||
}
|
||||
func (e *ServiceQuotaExceededException) ErrorMessage() string {
|
||||
if e.Message == nil {
|
||||
return ""
|
||||
}
|
||||
return *e.Message
|
||||
}
|
||||
func (e *ServiceQuotaExceededException) ErrorCode() string {
|
||||
if e == nil || e.ErrorCodeOverride == nil {
|
||||
return "ServiceQuotaExceededException"
|
||||
}
|
||||
return *e.ErrorCodeOverride
|
||||
}
|
||||
func (e *ServiceQuotaExceededException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
|
||||
|
||||
// Amazon Textract is temporarily unable to process the request. Try your call
|
||||
// again.
|
||||
type ThrottlingException struct {
|
||||
Message *string
|
||||
|
||||
ErrorCodeOverride *string
|
||||
|
||||
Code *string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (e *ThrottlingException) Error() string {
|
||||
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
|
||||
}
|
||||
func (e *ThrottlingException) ErrorMessage() string {
|
||||
if e.Message == nil {
|
||||
return ""
|
||||
}
|
||||
return *e.Message
|
||||
}
|
||||
func (e *ThrottlingException) ErrorCode() string {
|
||||
if e == nil || e.ErrorCodeOverride == nil {
|
||||
return "ThrottlingException"
|
||||
}
|
||||
return *e.ErrorCodeOverride
|
||||
}
|
||||
func (e *ThrottlingException) ErrorFault() smithy.ErrorFault { return smithy.FaultServer }
|
||||
|
||||
// The format of the input document isn't supported. Documents for operations can
|
||||
// be in PNG, JPEG, PDF, or TIFF format.
|
||||
type UnsupportedDocumentException struct {
|
||||
Message *string
|
||||
|
||||
ErrorCodeOverride *string
|
||||
|
||||
Code *string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (e *UnsupportedDocumentException) Error() string {
|
||||
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
|
||||
}
|
||||
func (e *UnsupportedDocumentException) ErrorMessage() string {
|
||||
if e.Message == nil {
|
||||
return ""
|
||||
}
|
||||
return *e.Message
|
||||
}
|
||||
func (e *UnsupportedDocumentException) ErrorCode() string {
|
||||
if e == nil || e.ErrorCodeOverride == nil {
|
||||
return "UnsupportedDocumentException"
|
||||
}
|
||||
return *e.ErrorCodeOverride
|
||||
}
|
||||
func (e *UnsupportedDocumentException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
|
||||
|
||||
// Indicates that a request was not valid. Check request for proper formatting.
|
||||
type ValidationException struct {
|
||||
Message *string
|
||||
|
||||
ErrorCodeOverride *string
|
||||
|
||||
Code *string
|
||||
|
||||
noSmithyDocumentSerde
|
||||
}
|
||||
|
||||
func (e *ValidationException) Error() string {
|
||||
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
|
||||
}
|
||||
func (e *ValidationException) ErrorMessage() string {
|
||||
if e.Message == nil {
|
||||
return ""
|
||||
}
|
||||
return *e.Message
|
||||
}
|
||||
func (e *ValidationException) ErrorCode() string {
|
||||
if e == nil || e.ErrorCodeOverride == nil {
|
||||
return "ValidationException"
|
||||
}
|
||||
return *e.ErrorCodeOverride
|
||||
}
|
||||
func (e *ValidationException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
|
||||
+1103
File diff suppressed because it is too large
Load Diff
+1160
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user