aws-sdk-qconnect 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,180 @@
1
+ # frozen_string_literal: true
2
+
3
+ # WARNING ABOUT GENERATED CODE
4
+ #
5
+ # This file is generated. See the contributing guide for more information:
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
7
+ #
8
+ # WARNING ABOUT GENERATED CODE
9
+
10
+ module Aws::QConnect
11
+
12
+ # When QConnect returns an error response, the Ruby SDK constructs and raises an error.
13
+ # These errors all extend Aws::QConnect::Errors::ServiceError < {Aws::Errors::ServiceError}
14
+ #
15
+ # You can rescue all QConnect errors using ServiceError:
16
+ #
17
+ # begin
18
+ # # do stuff
19
+ # rescue Aws::QConnect::Errors::ServiceError
20
+ # # rescues all QConnect API errors
21
+ # end
22
+ #
23
+ #
24
+ # ## Request Context
25
+ # ServiceError objects have a {Aws::Errors::ServiceError#context #context} method that returns
26
+ # information about the request that generated the error.
27
+ # See {Seahorse::Client::RequestContext} for more information.
28
+ #
29
+ # ## Error Classes
30
+ # * {AccessDeniedException}
31
+ # * {ConflictException}
32
+ # * {PreconditionFailedException}
33
+ # * {RequestTimeoutException}
34
+ # * {ResourceNotFoundException}
35
+ # * {ServiceQuotaExceededException}
36
+ # * {TooManyTagsException}
37
+ # * {ValidationException}
38
+ #
39
+ # Additionally, error classes are dynamically generated for service errors based on the error code
40
+ # if they are not defined above.
41
+ module Errors
42
+
43
+ extend Aws::Errors::DynamicErrors
44
+
45
+ class AccessDeniedException < ServiceError
46
+
47
+ # @param [Seahorse::Client::RequestContext] context
48
+ # @param [String] message
49
+ # @param [Aws::QConnect::Types::AccessDeniedException] data
50
+ def initialize(context, message, data = Aws::EmptyStructure.new)
51
+ super(context, message, data)
52
+ end
53
+
54
+ # @return [String]
55
+ def message
56
+ @message || @data[:message]
57
+ end
58
+ end
59
+
60
+ class ConflictException < ServiceError
61
+
62
+ # @param [Seahorse::Client::RequestContext] context
63
+ # @param [String] message
64
+ # @param [Aws::QConnect::Types::ConflictException] data
65
+ def initialize(context, message, data = Aws::EmptyStructure.new)
66
+ super(context, message, data)
67
+ end
68
+
69
+ # @return [String]
70
+ def message
71
+ @message || @data[:message]
72
+ end
73
+ end
74
+
75
+ class PreconditionFailedException < ServiceError
76
+
77
+ # @param [Seahorse::Client::RequestContext] context
78
+ # @param [String] message
79
+ # @param [Aws::QConnect::Types::PreconditionFailedException] data
80
+ def initialize(context, message, data = Aws::EmptyStructure.new)
81
+ super(context, message, data)
82
+ end
83
+
84
+ # @return [String]
85
+ def message
86
+ @message || @data[:message]
87
+ end
88
+ end
89
+
90
+ class RequestTimeoutException < ServiceError
91
+
92
+ # @param [Seahorse::Client::RequestContext] context
93
+ # @param [String] message
94
+ # @param [Aws::QConnect::Types::RequestTimeoutException] data
95
+ def initialize(context, message, data = Aws::EmptyStructure.new)
96
+ super(context, message, data)
97
+ end
98
+
99
+ # @return [String]
100
+ def message
101
+ @message || @data[:message]
102
+ end
103
+
104
+ def retryable?
105
+ true
106
+ end
107
+ end
108
+
109
+ class ResourceNotFoundException < ServiceError
110
+
111
+ # @param [Seahorse::Client::RequestContext] context
112
+ # @param [String] message
113
+ # @param [Aws::QConnect::Types::ResourceNotFoundException] data
114
+ def initialize(context, message, data = Aws::EmptyStructure.new)
115
+ super(context, message, data)
116
+ end
117
+
118
+ # @return [String]
119
+ def message
120
+ @message || @data[:message]
121
+ end
122
+
123
+ # @return [String]
124
+ def resource_name
125
+ @data[:resource_name]
126
+ end
127
+ end
128
+
129
+ class ServiceQuotaExceededException < ServiceError
130
+
131
+ # @param [Seahorse::Client::RequestContext] context
132
+ # @param [String] message
133
+ # @param [Aws::QConnect::Types::ServiceQuotaExceededException] data
134
+ def initialize(context, message, data = Aws::EmptyStructure.new)
135
+ super(context, message, data)
136
+ end
137
+
138
+ # @return [String]
139
+ def message
140
+ @message || @data[:message]
141
+ end
142
+ end
143
+
144
+ class TooManyTagsException < ServiceError
145
+
146
+ # @param [Seahorse::Client::RequestContext] context
147
+ # @param [String] message
148
+ # @param [Aws::QConnect::Types::TooManyTagsException] data
149
+ def initialize(context, message, data = Aws::EmptyStructure.new)
150
+ super(context, message, data)
151
+ end
152
+
153
+ # @return [String]
154
+ def message
155
+ @message || @data[:message]
156
+ end
157
+
158
+ # @return [String]
159
+ def resource_name
160
+ @data[:resource_name]
161
+ end
162
+ end
163
+
164
+ class ValidationException < ServiceError
165
+
166
+ # @param [Seahorse::Client::RequestContext] context
167
+ # @param [String] message
168
+ # @param [Aws::QConnect::Types::ValidationException] data
169
+ def initialize(context, message, data = Aws::EmptyStructure.new)
170
+ super(context, message, data)
171
+ end
172
+
173
+ # @return [String]
174
+ def message
175
+ @message || @data[:message]
176
+ end
177
+ end
178
+
179
+ end
180
+ end
@@ -0,0 +1,151 @@
1
+ # frozen_string_literal: true
2
+
3
+ # WARNING ABOUT GENERATED CODE
4
+ #
5
+ # This file is generated. See the contributing guide for more information:
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
7
+ #
8
+ # WARNING ABOUT GENERATED CODE
9
+
10
+
11
+ module Aws::QConnect
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::QConnect::EndpointProvider',
17
+ docstring: 'The endpoint provider used to resolve endpoints. Any '\
18
+ 'object that responds to `#resolve_endpoint(parameters)` '\
19
+ 'where `parameters` is a Struct similar to '\
20
+ '`Aws::QConnect::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::QConnect::EndpointProvider.new
23
+ end
24
+
25
+ # @api private
26
+ class Handler < Seahorse::Client::Handler
27
+ def call(context)
28
+ unless context[:discovered_endpoint]
29
+ params = parameters_for_operation(context)
30
+ endpoint = context.config.endpoint_provider.resolve_endpoint(params)
31
+
32
+ context.http_request.endpoint = endpoint.url
33
+ apply_endpoint_headers(context, endpoint.headers)
34
+
35
+ context[:endpoint_params] = params
36
+ context[:endpoint_properties] = endpoint.properties
37
+ end
38
+
39
+ context[:auth_scheme] =
40
+ Aws::Endpoints.resolve_auth_scheme(context, endpoint)
41
+
42
+ @handler.call(context)
43
+ end
44
+
45
+ private
46
+
47
+ def apply_endpoint_headers(context, headers)
48
+ headers.each do |key, values|
49
+ value = values
50
+ .compact
51
+ .map { |s| Seahorse::Util.escape_header_list_string(s.to_s) }
52
+ .join(',')
53
+
54
+ context.http_request.headers[key] = value
55
+ end
56
+ end
57
+
58
+ def parameters_for_operation(context)
59
+ case context.operation_name
60
+ when :create_assistant
61
+ Aws::QConnect::Endpoints::CreateAssistant.build(context)
62
+ when :create_assistant_association
63
+ Aws::QConnect::Endpoints::CreateAssistantAssociation.build(context)
64
+ when :create_content
65
+ Aws::QConnect::Endpoints::CreateContent.build(context)
66
+ when :create_knowledge_base
67
+ Aws::QConnect::Endpoints::CreateKnowledgeBase.build(context)
68
+ when :create_quick_response
69
+ Aws::QConnect::Endpoints::CreateQuickResponse.build(context)
70
+ when :create_session
71
+ Aws::QConnect::Endpoints::CreateSession.build(context)
72
+ when :delete_assistant
73
+ Aws::QConnect::Endpoints::DeleteAssistant.build(context)
74
+ when :delete_assistant_association
75
+ Aws::QConnect::Endpoints::DeleteAssistantAssociation.build(context)
76
+ when :delete_content
77
+ Aws::QConnect::Endpoints::DeleteContent.build(context)
78
+ when :delete_import_job
79
+ Aws::QConnect::Endpoints::DeleteImportJob.build(context)
80
+ when :delete_knowledge_base
81
+ Aws::QConnect::Endpoints::DeleteKnowledgeBase.build(context)
82
+ when :delete_quick_response
83
+ Aws::QConnect::Endpoints::DeleteQuickResponse.build(context)
84
+ when :get_assistant
85
+ Aws::QConnect::Endpoints::GetAssistant.build(context)
86
+ when :get_assistant_association
87
+ Aws::QConnect::Endpoints::GetAssistantAssociation.build(context)
88
+ when :get_content
89
+ Aws::QConnect::Endpoints::GetContent.build(context)
90
+ when :get_content_summary
91
+ Aws::QConnect::Endpoints::GetContentSummary.build(context)
92
+ when :get_import_job
93
+ Aws::QConnect::Endpoints::GetImportJob.build(context)
94
+ when :get_knowledge_base
95
+ Aws::QConnect::Endpoints::GetKnowledgeBase.build(context)
96
+ when :get_quick_response
97
+ Aws::QConnect::Endpoints::GetQuickResponse.build(context)
98
+ when :get_recommendations
99
+ Aws::QConnect::Endpoints::GetRecommendations.build(context)
100
+ when :get_session
101
+ Aws::QConnect::Endpoints::GetSession.build(context)
102
+ when :list_assistant_associations
103
+ Aws::QConnect::Endpoints::ListAssistantAssociations.build(context)
104
+ when :list_assistants
105
+ Aws::QConnect::Endpoints::ListAssistants.build(context)
106
+ when :list_contents
107
+ Aws::QConnect::Endpoints::ListContents.build(context)
108
+ when :list_import_jobs
109
+ Aws::QConnect::Endpoints::ListImportJobs.build(context)
110
+ when :list_knowledge_bases
111
+ Aws::QConnect::Endpoints::ListKnowledgeBases.build(context)
112
+ when :list_quick_responses
113
+ Aws::QConnect::Endpoints::ListQuickResponses.build(context)
114
+ when :list_tags_for_resource
115
+ Aws::QConnect::Endpoints::ListTagsForResource.build(context)
116
+ when :notify_recommendations_received
117
+ Aws::QConnect::Endpoints::NotifyRecommendationsReceived.build(context)
118
+ when :query_assistant
119
+ Aws::QConnect::Endpoints::QueryAssistant.build(context)
120
+ when :remove_knowledge_base_template_uri
121
+ Aws::QConnect::Endpoints::RemoveKnowledgeBaseTemplateUri.build(context)
122
+ when :search_content
123
+ Aws::QConnect::Endpoints::SearchContent.build(context)
124
+ when :search_quick_responses
125
+ Aws::QConnect::Endpoints::SearchQuickResponses.build(context)
126
+ when :search_sessions
127
+ Aws::QConnect::Endpoints::SearchSessions.build(context)
128
+ when :start_content_upload
129
+ Aws::QConnect::Endpoints::StartContentUpload.build(context)
130
+ when :start_import_job
131
+ Aws::QConnect::Endpoints::StartImportJob.build(context)
132
+ when :tag_resource
133
+ Aws::QConnect::Endpoints::TagResource.build(context)
134
+ when :untag_resource
135
+ Aws::QConnect::Endpoints::UntagResource.build(context)
136
+ when :update_content
137
+ Aws::QConnect::Endpoints::UpdateContent.build(context)
138
+ when :update_knowledge_base_template_uri
139
+ Aws::QConnect::Endpoints::UpdateKnowledgeBaseTemplateUri.build(context)
140
+ when :update_quick_response
141
+ Aws::QConnect::Endpoints::UpdateQuickResponse.build(context)
142
+ end
143
+ end
144
+ end
145
+
146
+ def add_handlers(handlers, _config)
147
+ handlers.add(Handler, step: :build, priority: 75)
148
+ end
149
+ end
150
+ end
151
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ # WARNING ABOUT GENERATED CODE
4
+ #
5
+ # This file is generated. See the contributing guide for more information:
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
7
+ #
8
+ # WARNING ABOUT GENERATED CODE
9
+
10
+ module Aws::QConnect
11
+
12
+ class Resource
13
+
14
+ # @param options ({})
15
+ # @option options [Client] :client
16
+ def initialize(options = {})
17
+ @client = options[:client] || Client.new(options)
18
+ end
19
+
20
+ # @return [Client]
21
+ def client
22
+ @client
23
+ end
24
+
25
+ end
26
+ end