aws-sdk-bedrockagent 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,155 @@
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::BedrockAgent
11
+
12
+ # When BedrockAgent returns an error response, the Ruby SDK constructs and raises an error.
13
+ # These errors all extend Aws::BedrockAgent::Errors::ServiceError < {Aws::Errors::ServiceError}
14
+ #
15
+ # You can rescue all BedrockAgent errors using ServiceError:
16
+ #
17
+ # begin
18
+ # # do stuff
19
+ # rescue Aws::BedrockAgent::Errors::ServiceError
20
+ # # rescues all BedrockAgent 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
+ # * {InternalServerException}
33
+ # * {ResourceNotFoundException}
34
+ # * {ServiceQuotaExceededException}
35
+ # * {ThrottlingException}
36
+ # * {ValidationException}
37
+ #
38
+ # Additionally, error classes are dynamically generated for service errors based on the error code
39
+ # if they are not defined above.
40
+ module Errors
41
+
42
+ extend Aws::Errors::DynamicErrors
43
+
44
+ class AccessDeniedException < ServiceError
45
+
46
+ # @param [Seahorse::Client::RequestContext] context
47
+ # @param [String] message
48
+ # @param [Aws::BedrockAgent::Types::AccessDeniedException] data
49
+ def initialize(context, message, data = Aws::EmptyStructure.new)
50
+ super(context, message, data)
51
+ end
52
+
53
+ # @return [String]
54
+ def message
55
+ @message || @data[:message]
56
+ end
57
+ end
58
+
59
+ class ConflictException < ServiceError
60
+
61
+ # @param [Seahorse::Client::RequestContext] context
62
+ # @param [String] message
63
+ # @param [Aws::BedrockAgent::Types::ConflictException] data
64
+ def initialize(context, message, data = Aws::EmptyStructure.new)
65
+ super(context, message, data)
66
+ end
67
+
68
+ # @return [String]
69
+ def message
70
+ @message || @data[:message]
71
+ end
72
+ end
73
+
74
+ class InternalServerException < ServiceError
75
+
76
+ # @param [Seahorse::Client::RequestContext] context
77
+ # @param [String] message
78
+ # @param [Aws::BedrockAgent::Types::InternalServerException] data
79
+ def initialize(context, message, data = Aws::EmptyStructure.new)
80
+ super(context, message, data)
81
+ end
82
+
83
+ # @return [String]
84
+ def message
85
+ @message || @data[:message]
86
+ end
87
+ end
88
+
89
+ class ResourceNotFoundException < ServiceError
90
+
91
+ # @param [Seahorse::Client::RequestContext] context
92
+ # @param [String] message
93
+ # @param [Aws::BedrockAgent::Types::ResourceNotFoundException] data
94
+ def initialize(context, message, data = Aws::EmptyStructure.new)
95
+ super(context, message, data)
96
+ end
97
+
98
+ # @return [String]
99
+ def message
100
+ @message || @data[:message]
101
+ end
102
+ end
103
+
104
+ class ServiceQuotaExceededException < ServiceError
105
+
106
+ # @param [Seahorse::Client::RequestContext] context
107
+ # @param [String] message
108
+ # @param [Aws::BedrockAgent::Types::ServiceQuotaExceededException] data
109
+ def initialize(context, message, data = Aws::EmptyStructure.new)
110
+ super(context, message, data)
111
+ end
112
+
113
+ # @return [String]
114
+ def message
115
+ @message || @data[:message]
116
+ end
117
+ end
118
+
119
+ class ThrottlingException < ServiceError
120
+
121
+ # @param [Seahorse::Client::RequestContext] context
122
+ # @param [String] message
123
+ # @param [Aws::BedrockAgent::Types::ThrottlingException] data
124
+ def initialize(context, message, data = Aws::EmptyStructure.new)
125
+ super(context, message, data)
126
+ end
127
+
128
+ # @return [String]
129
+ def message
130
+ @message || @data[:message]
131
+ end
132
+ end
133
+
134
+ class ValidationException < ServiceError
135
+
136
+ # @param [Seahorse::Client::RequestContext] context
137
+ # @param [String] message
138
+ # @param [Aws::BedrockAgent::Types::ValidationException] data
139
+ def initialize(context, message, data = Aws::EmptyStructure.new)
140
+ super(context, message, data)
141
+ end
142
+
143
+ # @return [String]
144
+ def message
145
+ @message || @data[:message]
146
+ end
147
+
148
+ # @return [String]
149
+ def field_list
150
+ @data[:field_list]
151
+ end
152
+ end
153
+
154
+ end
155
+ end
@@ -0,0 +1,149 @@
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::BedrockAgent
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::BedrockAgent::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::BedrockAgent::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::BedrockAgent::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 :associate_agent_knowledge_base
61
+ Aws::BedrockAgent::Endpoints::AssociateAgentKnowledgeBase.build(context)
62
+ when :create_agent
63
+ Aws::BedrockAgent::Endpoints::CreateAgent.build(context)
64
+ when :create_agent_action_group
65
+ Aws::BedrockAgent::Endpoints::CreateAgentActionGroup.build(context)
66
+ when :create_agent_alias
67
+ Aws::BedrockAgent::Endpoints::CreateAgentAlias.build(context)
68
+ when :create_data_source
69
+ Aws::BedrockAgent::Endpoints::CreateDataSource.build(context)
70
+ when :create_knowledge_base
71
+ Aws::BedrockAgent::Endpoints::CreateKnowledgeBase.build(context)
72
+ when :delete_agent
73
+ Aws::BedrockAgent::Endpoints::DeleteAgent.build(context)
74
+ when :delete_agent_action_group
75
+ Aws::BedrockAgent::Endpoints::DeleteAgentActionGroup.build(context)
76
+ when :delete_agent_alias
77
+ Aws::BedrockAgent::Endpoints::DeleteAgentAlias.build(context)
78
+ when :delete_agent_version
79
+ Aws::BedrockAgent::Endpoints::DeleteAgentVersion.build(context)
80
+ when :delete_data_source
81
+ Aws::BedrockAgent::Endpoints::DeleteDataSource.build(context)
82
+ when :delete_knowledge_base
83
+ Aws::BedrockAgent::Endpoints::DeleteKnowledgeBase.build(context)
84
+ when :disassociate_agent_knowledge_base
85
+ Aws::BedrockAgent::Endpoints::DisassociateAgentKnowledgeBase.build(context)
86
+ when :get_agent
87
+ Aws::BedrockAgent::Endpoints::GetAgent.build(context)
88
+ when :get_agent_action_group
89
+ Aws::BedrockAgent::Endpoints::GetAgentActionGroup.build(context)
90
+ when :get_agent_alias
91
+ Aws::BedrockAgent::Endpoints::GetAgentAlias.build(context)
92
+ when :get_agent_knowledge_base
93
+ Aws::BedrockAgent::Endpoints::GetAgentKnowledgeBase.build(context)
94
+ when :get_agent_version
95
+ Aws::BedrockAgent::Endpoints::GetAgentVersion.build(context)
96
+ when :get_data_source
97
+ Aws::BedrockAgent::Endpoints::GetDataSource.build(context)
98
+ when :get_ingestion_job
99
+ Aws::BedrockAgent::Endpoints::GetIngestionJob.build(context)
100
+ when :get_knowledge_base
101
+ Aws::BedrockAgent::Endpoints::GetKnowledgeBase.build(context)
102
+ when :list_agent_action_groups
103
+ Aws::BedrockAgent::Endpoints::ListAgentActionGroups.build(context)
104
+ when :list_agent_aliases
105
+ Aws::BedrockAgent::Endpoints::ListAgentAliases.build(context)
106
+ when :list_agent_knowledge_bases
107
+ Aws::BedrockAgent::Endpoints::ListAgentKnowledgeBases.build(context)
108
+ when :list_agent_versions
109
+ Aws::BedrockAgent::Endpoints::ListAgentVersions.build(context)
110
+ when :list_agents
111
+ Aws::BedrockAgent::Endpoints::ListAgents.build(context)
112
+ when :list_data_sources
113
+ Aws::BedrockAgent::Endpoints::ListDataSources.build(context)
114
+ when :list_ingestion_jobs
115
+ Aws::BedrockAgent::Endpoints::ListIngestionJobs.build(context)
116
+ when :list_knowledge_bases
117
+ Aws::BedrockAgent::Endpoints::ListKnowledgeBases.build(context)
118
+ when :list_tags_for_resource
119
+ Aws::BedrockAgent::Endpoints::ListTagsForResource.build(context)
120
+ when :prepare_agent
121
+ Aws::BedrockAgent::Endpoints::PrepareAgent.build(context)
122
+ when :start_ingestion_job
123
+ Aws::BedrockAgent::Endpoints::StartIngestionJob.build(context)
124
+ when :tag_resource
125
+ Aws::BedrockAgent::Endpoints::TagResource.build(context)
126
+ when :untag_resource
127
+ Aws::BedrockAgent::Endpoints::UntagResource.build(context)
128
+ when :update_agent
129
+ Aws::BedrockAgent::Endpoints::UpdateAgent.build(context)
130
+ when :update_agent_action_group
131
+ Aws::BedrockAgent::Endpoints::UpdateAgentActionGroup.build(context)
132
+ when :update_agent_alias
133
+ Aws::BedrockAgent::Endpoints::UpdateAgentAlias.build(context)
134
+ when :update_agent_knowledge_base
135
+ Aws::BedrockAgent::Endpoints::UpdateAgentKnowledgeBase.build(context)
136
+ when :update_data_source
137
+ Aws::BedrockAgent::Endpoints::UpdateDataSource.build(context)
138
+ when :update_knowledge_base
139
+ Aws::BedrockAgent::Endpoints::UpdateKnowledgeBase.build(context)
140
+ end
141
+ end
142
+ end
143
+
144
+ def add_handlers(handlers, _config)
145
+ handlers.add(Handler, step: :build, priority: 75)
146
+ end
147
+ end
148
+ end
149
+ 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::BedrockAgent
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