aws-sdk-mediapackagev2 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,116 @@
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::MediaPackageV2
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::MediaPackageV2::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::MediaPackageV2::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::MediaPackageV2::EndpointProvider.new
23
+ end
24
+
25
+ # @api private
26
+ class Handler < Seahorse::Client::Handler
27
+ def call(context)
28
+ # If endpoint was discovered, do not resolve or apply the endpoint.
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
+ end
36
+
37
+ context[:endpoint_params] = params
38
+ context[:auth_scheme] =
39
+ Aws::Endpoints.resolve_auth_scheme(context, endpoint)
40
+
41
+ @handler.call(context)
42
+ end
43
+
44
+ private
45
+
46
+ def apply_endpoint_headers(context, headers)
47
+ headers.each do |key, values|
48
+ value = values
49
+ .compact
50
+ .map { |s| Seahorse::Util.escape_header_list_string(s.to_s) }
51
+ .join(',')
52
+
53
+ context.http_request.headers[key] = value
54
+ end
55
+ end
56
+
57
+ def parameters_for_operation(context)
58
+ case context.operation_name
59
+ when :create_channel
60
+ Aws::MediaPackageV2::Endpoints::CreateChannel.build(context)
61
+ when :create_channel_group
62
+ Aws::MediaPackageV2::Endpoints::CreateChannelGroup.build(context)
63
+ when :create_origin_endpoint
64
+ Aws::MediaPackageV2::Endpoints::CreateOriginEndpoint.build(context)
65
+ when :delete_channel
66
+ Aws::MediaPackageV2::Endpoints::DeleteChannel.build(context)
67
+ when :delete_channel_group
68
+ Aws::MediaPackageV2::Endpoints::DeleteChannelGroup.build(context)
69
+ when :delete_channel_policy
70
+ Aws::MediaPackageV2::Endpoints::DeleteChannelPolicy.build(context)
71
+ when :delete_origin_endpoint
72
+ Aws::MediaPackageV2::Endpoints::DeleteOriginEndpoint.build(context)
73
+ when :delete_origin_endpoint_policy
74
+ Aws::MediaPackageV2::Endpoints::DeleteOriginEndpointPolicy.build(context)
75
+ when :get_channel
76
+ Aws::MediaPackageV2::Endpoints::GetChannel.build(context)
77
+ when :get_channel_group
78
+ Aws::MediaPackageV2::Endpoints::GetChannelGroup.build(context)
79
+ when :get_channel_policy
80
+ Aws::MediaPackageV2::Endpoints::GetChannelPolicy.build(context)
81
+ when :get_origin_endpoint
82
+ Aws::MediaPackageV2::Endpoints::GetOriginEndpoint.build(context)
83
+ when :get_origin_endpoint_policy
84
+ Aws::MediaPackageV2::Endpoints::GetOriginEndpointPolicy.build(context)
85
+ when :list_channel_groups
86
+ Aws::MediaPackageV2::Endpoints::ListChannelGroups.build(context)
87
+ when :list_channels
88
+ Aws::MediaPackageV2::Endpoints::ListChannels.build(context)
89
+ when :list_origin_endpoints
90
+ Aws::MediaPackageV2::Endpoints::ListOriginEndpoints.build(context)
91
+ when :list_tags_for_resource
92
+ Aws::MediaPackageV2::Endpoints::ListTagsForResource.build(context)
93
+ when :put_channel_policy
94
+ Aws::MediaPackageV2::Endpoints::PutChannelPolicy.build(context)
95
+ when :put_origin_endpoint_policy
96
+ Aws::MediaPackageV2::Endpoints::PutOriginEndpointPolicy.build(context)
97
+ when :tag_resource
98
+ Aws::MediaPackageV2::Endpoints::TagResource.build(context)
99
+ when :untag_resource
100
+ Aws::MediaPackageV2::Endpoints::UntagResource.build(context)
101
+ when :update_channel
102
+ Aws::MediaPackageV2::Endpoints::UpdateChannel.build(context)
103
+ when :update_channel_group
104
+ Aws::MediaPackageV2::Endpoints::UpdateChannelGroup.build(context)
105
+ when :update_origin_endpoint
106
+ Aws::MediaPackageV2::Endpoints::UpdateOriginEndpoint.build(context)
107
+ end
108
+ end
109
+ end
110
+
111
+ def add_handlers(handlers, _config)
112
+ handlers.add(Handler, step: :build, priority: 75)
113
+ end
114
+ end
115
+ end
116
+ 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::MediaPackageV2
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