aws-sdk-socialmessaging 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,54 @@
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::SocialMessaging
11
+ class EndpointProvider
12
+ def resolve_endpoint(parameters)
13
+ region = parameters.region
14
+ use_dual_stack = parameters.use_dual_stack
15
+ use_fips = parameters.use_fips
16
+ endpoint = parameters.endpoint
17
+ if Aws::Endpoints::Matchers.set?(endpoint)
18
+ if Aws::Endpoints::Matchers.boolean_equals?(use_fips, true)
19
+ raise ArgumentError, "Invalid Configuration: FIPS and custom endpoint are not supported"
20
+ end
21
+ if Aws::Endpoints::Matchers.boolean_equals?(use_dual_stack, true)
22
+ raise ArgumentError, "Invalid Configuration: Dualstack and custom endpoint are not supported"
23
+ end
24
+ return Aws::Endpoints::Endpoint.new(url: endpoint, headers: {}, properties: {})
25
+ end
26
+ if Aws::Endpoints::Matchers.set?(region)
27
+ if (partition_result = Aws::Endpoints::Matchers.aws_partition(region))
28
+ if Aws::Endpoints::Matchers.boolean_equals?(use_fips, true) && Aws::Endpoints::Matchers.boolean_equals?(use_dual_stack, true)
29
+ if Aws::Endpoints::Matchers.boolean_equals?(true, Aws::Endpoints::Matchers.attr(partition_result, "supportsFIPS")) && Aws::Endpoints::Matchers.boolean_equals?(true, Aws::Endpoints::Matchers.attr(partition_result, "supportsDualStack"))
30
+ return Aws::Endpoints::Endpoint.new(url: "https://social-messaging-fips.#{region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {})
31
+ end
32
+ raise ArgumentError, "FIPS and DualStack are enabled, but this partition does not support one or both"
33
+ end
34
+ if Aws::Endpoints::Matchers.boolean_equals?(use_fips, true)
35
+ if Aws::Endpoints::Matchers.boolean_equals?(Aws::Endpoints::Matchers.attr(partition_result, "supportsFIPS"), true)
36
+ return Aws::Endpoints::Endpoint.new(url: "https://social-messaging-fips.#{region}.#{partition_result['dnsSuffix']}", headers: {}, properties: {})
37
+ end
38
+ raise ArgumentError, "FIPS is enabled but this partition does not support FIPS"
39
+ end
40
+ if Aws::Endpoints::Matchers.boolean_equals?(use_dual_stack, true)
41
+ if Aws::Endpoints::Matchers.boolean_equals?(true, Aws::Endpoints::Matchers.attr(partition_result, "supportsDualStack"))
42
+ return Aws::Endpoints::Endpoint.new(url: "https://social-messaging.#{region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {})
43
+ end
44
+ raise ArgumentError, "DualStack is enabled but this partition does not support DualStack"
45
+ end
46
+ return Aws::Endpoints::Endpoint.new(url: "https://social-messaging.#{region}.#{partition_result['dnsSuffix']}", headers: {}, properties: {})
47
+ end
48
+ end
49
+ raise ArgumentError, "Invalid Configuration: Missing Region"
50
+ raise ArgumentError, 'No endpoint could be resolved'
51
+
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,159 @@
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::SocialMessaging
12
+ # @api private
13
+ module Endpoints
14
+
15
+ class AssociateWhatsAppBusinessAccount
16
+ def self.build(context)
17
+ Aws::SocialMessaging::EndpointParameters.new(
18
+ region: context.config.region,
19
+ use_dual_stack: context.config.use_dualstack_endpoint,
20
+ use_fips: context.config.use_fips_endpoint,
21
+ endpoint: context.config.regional_endpoint ? nil : context.config.endpoint.to_s,
22
+ )
23
+ end
24
+ end
25
+
26
+ class DeleteWhatsAppMessageMedia
27
+ def self.build(context)
28
+ Aws::SocialMessaging::EndpointParameters.new(
29
+ region: context.config.region,
30
+ use_dual_stack: context.config.use_dualstack_endpoint,
31
+ use_fips: context.config.use_fips_endpoint,
32
+ endpoint: context.config.regional_endpoint ? nil : context.config.endpoint.to_s,
33
+ )
34
+ end
35
+ end
36
+
37
+ class DisassociateWhatsAppBusinessAccount
38
+ def self.build(context)
39
+ Aws::SocialMessaging::EndpointParameters.new(
40
+ region: context.config.region,
41
+ use_dual_stack: context.config.use_dualstack_endpoint,
42
+ use_fips: context.config.use_fips_endpoint,
43
+ endpoint: context.config.regional_endpoint ? nil : context.config.endpoint.to_s,
44
+ )
45
+ end
46
+ end
47
+
48
+ class GetLinkedWhatsAppBusinessAccount
49
+ def self.build(context)
50
+ Aws::SocialMessaging::EndpointParameters.new(
51
+ region: context.config.region,
52
+ use_dual_stack: context.config.use_dualstack_endpoint,
53
+ use_fips: context.config.use_fips_endpoint,
54
+ endpoint: context.config.regional_endpoint ? nil : context.config.endpoint.to_s,
55
+ )
56
+ end
57
+ end
58
+
59
+ class GetLinkedWhatsAppBusinessAccountPhoneNumber
60
+ def self.build(context)
61
+ Aws::SocialMessaging::EndpointParameters.new(
62
+ region: context.config.region,
63
+ use_dual_stack: context.config.use_dualstack_endpoint,
64
+ use_fips: context.config.use_fips_endpoint,
65
+ endpoint: context.config.regional_endpoint ? nil : context.config.endpoint.to_s,
66
+ )
67
+ end
68
+ end
69
+
70
+ class GetWhatsAppMessageMedia
71
+ def self.build(context)
72
+ Aws::SocialMessaging::EndpointParameters.new(
73
+ region: context.config.region,
74
+ use_dual_stack: context.config.use_dualstack_endpoint,
75
+ use_fips: context.config.use_fips_endpoint,
76
+ endpoint: context.config.regional_endpoint ? nil : context.config.endpoint.to_s,
77
+ )
78
+ end
79
+ end
80
+
81
+ class ListLinkedWhatsAppBusinessAccounts
82
+ def self.build(context)
83
+ Aws::SocialMessaging::EndpointParameters.new(
84
+ region: context.config.region,
85
+ use_dual_stack: context.config.use_dualstack_endpoint,
86
+ use_fips: context.config.use_fips_endpoint,
87
+ endpoint: context.config.regional_endpoint ? nil : context.config.endpoint.to_s,
88
+ )
89
+ end
90
+ end
91
+
92
+ class ListTagsForResource
93
+ def self.build(context)
94
+ Aws::SocialMessaging::EndpointParameters.new(
95
+ region: context.config.region,
96
+ use_dual_stack: context.config.use_dualstack_endpoint,
97
+ use_fips: context.config.use_fips_endpoint,
98
+ endpoint: context.config.regional_endpoint ? nil : context.config.endpoint.to_s,
99
+ )
100
+ end
101
+ end
102
+
103
+ class PostWhatsAppMessageMedia
104
+ def self.build(context)
105
+ Aws::SocialMessaging::EndpointParameters.new(
106
+ region: context.config.region,
107
+ use_dual_stack: context.config.use_dualstack_endpoint,
108
+ use_fips: context.config.use_fips_endpoint,
109
+ endpoint: context.config.regional_endpoint ? nil : context.config.endpoint.to_s,
110
+ )
111
+ end
112
+ end
113
+
114
+ class PutWhatsAppBusinessAccountEventDestinations
115
+ def self.build(context)
116
+ Aws::SocialMessaging::EndpointParameters.new(
117
+ region: context.config.region,
118
+ use_dual_stack: context.config.use_dualstack_endpoint,
119
+ use_fips: context.config.use_fips_endpoint,
120
+ endpoint: context.config.regional_endpoint ? nil : context.config.endpoint.to_s,
121
+ )
122
+ end
123
+ end
124
+
125
+ class SendWhatsAppMessage
126
+ def self.build(context)
127
+ Aws::SocialMessaging::EndpointParameters.new(
128
+ region: context.config.region,
129
+ use_dual_stack: context.config.use_dualstack_endpoint,
130
+ use_fips: context.config.use_fips_endpoint,
131
+ endpoint: context.config.regional_endpoint ? nil : context.config.endpoint.to_s,
132
+ )
133
+ end
134
+ end
135
+
136
+ class TagResource
137
+ def self.build(context)
138
+ Aws::SocialMessaging::EndpointParameters.new(
139
+ region: context.config.region,
140
+ use_dual_stack: context.config.use_dualstack_endpoint,
141
+ use_fips: context.config.use_fips_endpoint,
142
+ endpoint: context.config.regional_endpoint ? nil : context.config.endpoint.to_s,
143
+ )
144
+ end
145
+ end
146
+
147
+ class UntagResource
148
+ def self.build(context)
149
+ Aws::SocialMessaging::EndpointParameters.new(
150
+ region: context.config.region,
151
+ use_dual_stack: context.config.use_dualstack_endpoint,
152
+ use_fips: context.config.use_fips_endpoint,
153
+ endpoint: context.config.regional_endpoint ? nil : context.config.endpoint.to_s,
154
+ )
155
+ end
156
+ end
157
+
158
+ end
159
+ end
@@ -0,0 +1,178 @@
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::SocialMessaging
11
+
12
+ # When SocialMessaging returns an error response, the Ruby SDK constructs and raises an error.
13
+ # These errors all extend Aws::SocialMessaging::Errors::ServiceError < {Aws::Errors::ServiceError}
14
+ #
15
+ # You can rescue all SocialMessaging errors using ServiceError:
16
+ #
17
+ # begin
18
+ # # do stuff
19
+ # rescue Aws::SocialMessaging::Errors::ServiceError
20
+ # # rescues all SocialMessaging 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
+ # * {AccessDeniedByMetaException}
31
+ # * {AccessDeniedException}
32
+ # * {DependencyException}
33
+ # * {InternalServiceException}
34
+ # * {InvalidParametersException}
35
+ # * {ResourceNotFoundException}
36
+ # * {ThrottledRequestException}
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 AccessDeniedByMetaException < ServiceError
46
+
47
+ # @param [Seahorse::Client::RequestContext] context
48
+ # @param [String] message
49
+ # @param [Aws::SocialMessaging::Types::AccessDeniedByMetaException] 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 AccessDeniedException < ServiceError
61
+
62
+ # @param [Seahorse::Client::RequestContext] context
63
+ # @param [String] message
64
+ # @param [Aws::SocialMessaging::Types::AccessDeniedException] 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 DependencyException < ServiceError
76
+
77
+ # @param [Seahorse::Client::RequestContext] context
78
+ # @param [String] message
79
+ # @param [Aws::SocialMessaging::Types::DependencyException] 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
+
89
+ def retryable?
90
+ true
91
+ end
92
+ end
93
+
94
+ class InternalServiceException < ServiceError
95
+
96
+ # @param [Seahorse::Client::RequestContext] context
97
+ # @param [String] message
98
+ # @param [Aws::SocialMessaging::Types::InternalServiceException] data
99
+ def initialize(context, message, data = Aws::EmptyStructure.new)
100
+ super(context, message, data)
101
+ end
102
+
103
+ # @return [String]
104
+ def message
105
+ @message || @data[:message]
106
+ end
107
+
108
+ def retryable?
109
+ true
110
+ end
111
+ end
112
+
113
+ class InvalidParametersException < ServiceError
114
+
115
+ # @param [Seahorse::Client::RequestContext] context
116
+ # @param [String] message
117
+ # @param [Aws::SocialMessaging::Types::InvalidParametersException] data
118
+ def initialize(context, message, data = Aws::EmptyStructure.new)
119
+ super(context, message, data)
120
+ end
121
+
122
+ # @return [String]
123
+ def message
124
+ @message || @data[:message]
125
+ end
126
+ end
127
+
128
+ class ResourceNotFoundException < ServiceError
129
+
130
+ # @param [Seahorse::Client::RequestContext] context
131
+ # @param [String] message
132
+ # @param [Aws::SocialMessaging::Types::ResourceNotFoundException] data
133
+ def initialize(context, message, data = Aws::EmptyStructure.new)
134
+ super(context, message, data)
135
+ end
136
+
137
+ # @return [String]
138
+ def message
139
+ @message || @data[:message]
140
+ end
141
+ end
142
+
143
+ class ThrottledRequestException < ServiceError
144
+
145
+ # @param [Seahorse::Client::RequestContext] context
146
+ # @param [String] message
147
+ # @param [Aws::SocialMessaging::Types::ThrottledRequestException] data
148
+ def initialize(context, message, data = Aws::EmptyStructure.new)
149
+ super(context, message, data)
150
+ end
151
+
152
+ # @return [String]
153
+ def message
154
+ @message || @data[:message]
155
+ end
156
+
157
+ def retryable?
158
+ true
159
+ end
160
+ end
161
+
162
+ class ValidationException < ServiceError
163
+
164
+ # @param [Seahorse::Client::RequestContext] context
165
+ # @param [String] message
166
+ # @param [Aws::SocialMessaging::Types::ValidationException] data
167
+ def initialize(context, message, data = Aws::EmptyStructure.new)
168
+ super(context, message, data)
169
+ end
170
+
171
+ # @return [String]
172
+ def message
173
+ @message || @data[:message]
174
+ end
175
+ end
176
+
177
+ end
178
+ end
@@ -0,0 +1,108 @@
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::SocialMessaging
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::SocialMessaging::EndpointProvider',
17
+ rbs_type: 'untyped',
18
+ docstring: <<~DOCS) do |_cfg|
19
+ The endpoint provider used to resolve endpoints. Any object that responds to
20
+ `#resolve_endpoint(parameters)` where `parameters` is a Struct similar to
21
+ `Aws::SocialMessaging::EndpointParameters`.
22
+ DOCS
23
+ Aws::SocialMessaging::EndpointProvider.new
24
+ end
25
+
26
+ # @api private
27
+ class Handler < Seahorse::Client::Handler
28
+ def call(context)
29
+ unless context[:discovered_endpoint]
30
+ params = parameters_for_operation(context)
31
+ endpoint = context.config.endpoint_provider.resolve_endpoint(params)
32
+
33
+ context.http_request.endpoint = endpoint.url
34
+ apply_endpoint_headers(context, endpoint.headers)
35
+
36
+ context[:endpoint_params] = params
37
+ context[:endpoint_properties] = endpoint.properties
38
+ end
39
+
40
+ context[:auth_scheme] =
41
+ Aws::Endpoints.resolve_auth_scheme(context, endpoint)
42
+
43
+ with_metrics(context) { @handler.call(context) }
44
+ end
45
+
46
+ private
47
+
48
+ def with_metrics(context, &block)
49
+ metrics = []
50
+ metrics << 'ENDPOINT_OVERRIDE' unless context.config.regional_endpoint
51
+ if context[:auth_scheme] && context[:auth_scheme]['name'] == 'sigv4a'
52
+ metrics << 'SIGV4A_SIGNING'
53
+ end
54
+ if context.config.credentials&.credentials&.account_id
55
+ metrics << 'RESOLVED_ACCOUNT_ID'
56
+ end
57
+ Aws::Plugins::UserAgent.metric(*metrics, &block)
58
+ end
59
+
60
+ def apply_endpoint_headers(context, headers)
61
+ headers.each do |key, values|
62
+ value = values
63
+ .compact
64
+ .map { |s| Seahorse::Util.escape_header_list_string(s.to_s) }
65
+ .join(',')
66
+
67
+ context.http_request.headers[key] = value
68
+ end
69
+ end
70
+
71
+ def parameters_for_operation(context)
72
+ case context.operation_name
73
+ when :associate_whats_app_business_account
74
+ Aws::SocialMessaging::Endpoints::AssociateWhatsAppBusinessAccount.build(context)
75
+ when :delete_whats_app_message_media
76
+ Aws::SocialMessaging::Endpoints::DeleteWhatsAppMessageMedia.build(context)
77
+ when :disassociate_whats_app_business_account
78
+ Aws::SocialMessaging::Endpoints::DisassociateWhatsAppBusinessAccount.build(context)
79
+ when :get_linked_whats_app_business_account
80
+ Aws::SocialMessaging::Endpoints::GetLinkedWhatsAppBusinessAccount.build(context)
81
+ when :get_linked_whats_app_business_account_phone_number
82
+ Aws::SocialMessaging::Endpoints::GetLinkedWhatsAppBusinessAccountPhoneNumber.build(context)
83
+ when :get_whats_app_message_media
84
+ Aws::SocialMessaging::Endpoints::GetWhatsAppMessageMedia.build(context)
85
+ when :list_linked_whats_app_business_accounts
86
+ Aws::SocialMessaging::Endpoints::ListLinkedWhatsAppBusinessAccounts.build(context)
87
+ when :list_tags_for_resource
88
+ Aws::SocialMessaging::Endpoints::ListTagsForResource.build(context)
89
+ when :post_whats_app_message_media
90
+ Aws::SocialMessaging::Endpoints::PostWhatsAppMessageMedia.build(context)
91
+ when :put_whats_app_business_account_event_destinations
92
+ Aws::SocialMessaging::Endpoints::PutWhatsAppBusinessAccountEventDestinations.build(context)
93
+ when :send_whats_app_message
94
+ Aws::SocialMessaging::Endpoints::SendWhatsAppMessage.build(context)
95
+ when :tag_resource
96
+ Aws::SocialMessaging::Endpoints::TagResource.build(context)
97
+ when :untag_resource
98
+ Aws::SocialMessaging::Endpoints::UntagResource.build(context)
99
+ end
100
+ end
101
+ end
102
+
103
+ def add_handlers(handlers, _config)
104
+ handlers.add(Handler, step: :build, priority: 75)
105
+ end
106
+ end
107
+ end
108
+ 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::SocialMessaging
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