aws-sdk-marketplaceagreement 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,163 @@
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::MarketplaceAgreement
11
+
12
+ # When MarketplaceAgreement returns an error response, the Ruby SDK constructs and raises an error.
13
+ # These errors all extend Aws::MarketplaceAgreement::Errors::ServiceError < {Aws::Errors::ServiceError}
14
+ #
15
+ # You can rescue all MarketplaceAgreement errors using ServiceError:
16
+ #
17
+ # begin
18
+ # # do stuff
19
+ # rescue Aws::MarketplaceAgreement::Errors::ServiceError
20
+ # # rescues all MarketplaceAgreement 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
+ # * {InternalServerException}
32
+ # * {ResourceNotFoundException}
33
+ # * {ThrottlingException}
34
+ # * {ValidationException}
35
+ #
36
+ # Additionally, error classes are dynamically generated for service errors based on the error code
37
+ # if they are not defined above.
38
+ module Errors
39
+
40
+ extend Aws::Errors::DynamicErrors
41
+
42
+ class AccessDeniedException < ServiceError
43
+
44
+ # @param [Seahorse::Client::RequestContext] context
45
+ # @param [String] message
46
+ # @param [Aws::MarketplaceAgreement::Types::AccessDeniedException] data
47
+ def initialize(context, message, data = Aws::EmptyStructure.new)
48
+ super(context, message, data)
49
+ end
50
+
51
+ # @return [String]
52
+ def message
53
+ @message || @data[:message]
54
+ end
55
+
56
+ # @return [String]
57
+ def request_id
58
+ @data[:request_id]
59
+ end
60
+ end
61
+
62
+ class InternalServerException < ServiceError
63
+
64
+ # @param [Seahorse::Client::RequestContext] context
65
+ # @param [String] message
66
+ # @param [Aws::MarketplaceAgreement::Types::InternalServerException] data
67
+ def initialize(context, message, data = Aws::EmptyStructure.new)
68
+ super(context, message, data)
69
+ end
70
+
71
+ # @return [String]
72
+ def message
73
+ @message || @data[:message]
74
+ end
75
+
76
+ # @return [String]
77
+ def request_id
78
+ @data[:request_id]
79
+ end
80
+ end
81
+
82
+ class ResourceNotFoundException < ServiceError
83
+
84
+ # @param [Seahorse::Client::RequestContext] context
85
+ # @param [String] message
86
+ # @param [Aws::MarketplaceAgreement::Types::ResourceNotFoundException] data
87
+ def initialize(context, message, data = Aws::EmptyStructure.new)
88
+ super(context, message, data)
89
+ end
90
+
91
+ # @return [String]
92
+ def message
93
+ @message || @data[:message]
94
+ end
95
+
96
+ # @return [String]
97
+ def request_id
98
+ @data[:request_id]
99
+ end
100
+
101
+ # @return [String]
102
+ def resource_id
103
+ @data[:resource_id]
104
+ end
105
+
106
+ # @return [String]
107
+ def resource_type
108
+ @data[:resource_type]
109
+ end
110
+ end
111
+
112
+ class ThrottlingException < ServiceError
113
+
114
+ # @param [Seahorse::Client::RequestContext] context
115
+ # @param [String] message
116
+ # @param [Aws::MarketplaceAgreement::Types::ThrottlingException] data
117
+ def initialize(context, message, data = Aws::EmptyStructure.new)
118
+ super(context, message, data)
119
+ end
120
+
121
+ # @return [String]
122
+ def message
123
+ @message || @data[:message]
124
+ end
125
+
126
+ # @return [String]
127
+ def request_id
128
+ @data[:request_id]
129
+ end
130
+ end
131
+
132
+ class ValidationException < ServiceError
133
+
134
+ # @param [Seahorse::Client::RequestContext] context
135
+ # @param [String] message
136
+ # @param [Aws::MarketplaceAgreement::Types::ValidationException] data
137
+ def initialize(context, message, data = Aws::EmptyStructure.new)
138
+ super(context, message, data)
139
+ end
140
+
141
+ # @return [String]
142
+ def fields
143
+ @data[:fields]
144
+ end
145
+
146
+ # @return [String]
147
+ def message
148
+ @message || @data[:message]
149
+ end
150
+
151
+ # @return [String]
152
+ def reason
153
+ @data[:reason]
154
+ end
155
+
156
+ # @return [String]
157
+ def request_id
158
+ @data[:request_id]
159
+ end
160
+ end
161
+
162
+ end
163
+ end
@@ -0,0 +1,75 @@
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::MarketplaceAgreement
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::MarketplaceAgreement::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::MarketplaceAgreement::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::MarketplaceAgreement::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 :describe_agreement
61
+ Aws::MarketplaceAgreement::Endpoints::DescribeAgreement.build(context)
62
+ when :get_agreement_terms
63
+ Aws::MarketplaceAgreement::Endpoints::GetAgreementTerms.build(context)
64
+ when :search_agreements
65
+ Aws::MarketplaceAgreement::Endpoints::SearchAgreements.build(context)
66
+ end
67
+ end
68
+ end
69
+
70
+ def add_handlers(handlers, _config)
71
+ handlers.add(Handler, step: :build, priority: 75)
72
+ end
73
+ end
74
+ end
75
+ 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::MarketplaceAgreement
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