aws-sdk-code-generator 0.2.0.pre → 0.2.1.pre
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.
- checksums.yaml +4 -4
- data/templates/apig_endpoint_class.mustache +16 -0
- data/templates/apig_readme.mustache +62 -0
- data/templates/async_client_class.mustache +127 -0
- data/templates/authorizer_class.mustache +37 -0
- data/templates/client_api_module.mustache +106 -0
- data/templates/client_class.mustache +295 -0
- data/templates/code.mustache +4 -0
- data/templates/documentation.mustache +4 -0
- data/templates/errors_module.mustache +70 -0
- data/templates/event_streams_module.mustache +76 -0
- data/templates/features/env.mustache +15 -0
- data/templates/features/smoke.mustache +17 -0
- data/templates/features/smoke_step_definitions.mustache +27 -0
- data/templates/features/step_definitions.mustache +8 -0
- data/templates/gemspec.mustache +30 -0
- data/templates/method.mustache +7 -0
- data/templates/resource_class.mustache +304 -0
- data/templates/root_resource_class.mustache +51 -0
- data/templates/service_module.mustache +48 -0
- data/templates/spec/spec_helper.mustache +15 -0
- data/templates/types_module.mustache +46 -0
- data/templates/version.mustache +1 -0
- data/templates/waiters_module.mustache +112 -0
- metadata +53 -2
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
{{#generated_src_warning}}
|
4
|
+
{{generated_src_warning}}
|
5
|
+
{{/generated_src_warning}}
|
6
|
+
module {{module_name}}
|
7
|
+
|
8
|
+
{{#documentation?}}
|
9
|
+
# This class provides a resource oriented interface for {{service_name}}.
|
10
|
+
# To create a resource object:
|
11
|
+
#
|
12
|
+
# resource = {{module_name}}::Resource.new(region: 'us-west-2')
|
13
|
+
#
|
14
|
+
# You can supply a client object with custom configuration that will be used for all resource operations.
|
15
|
+
# If you do not pass `:client`, a default client will be constructed.
|
16
|
+
#
|
17
|
+
# client = {{module_name}}::Client.new(region: 'us-west-2')
|
18
|
+
# resource = {{module_name}}::Resource.new(client: client)
|
19
|
+
#
|
20
|
+
{{/documentation?}}
|
21
|
+
class Resource
|
22
|
+
|
23
|
+
# @param options ({})
|
24
|
+
# @option options [Client] :client
|
25
|
+
def initialize(options = {})
|
26
|
+
@client = options[:client] || Client.new(options)
|
27
|
+
end
|
28
|
+
|
29
|
+
# @return [Client]
|
30
|
+
def client
|
31
|
+
@client
|
32
|
+
end
|
33
|
+
{{#actions?}}
|
34
|
+
|
35
|
+
# @!group Actions
|
36
|
+
{{#actions}}
|
37
|
+
|
38
|
+
{{> method}}
|
39
|
+
{{/actions}}
|
40
|
+
{{/actions?}}
|
41
|
+
{{#associations?}}
|
42
|
+
|
43
|
+
# @!group Associations
|
44
|
+
{{#associations}}
|
45
|
+
|
46
|
+
{{> method}}
|
47
|
+
{{/associations}}
|
48
|
+
{{/associations?}}
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
{{#generated_src_warning}}
|
4
|
+
{{generated_src_warning}}
|
5
|
+
{{/generated_src_warning}}
|
6
|
+
{{#requires}}
|
7
|
+
require '{{.}}'
|
8
|
+
{{/requires}}
|
9
|
+
|
10
|
+
{{#relative_requires}}
|
11
|
+
require_relative '{{.}}'
|
12
|
+
{{/relative_requires}}
|
13
|
+
|
14
|
+
# This module provides support for {{full_name}}. This module is available in the
|
15
|
+
# `{{gem_name}}` gem.
|
16
|
+
#
|
17
|
+
# # Client
|
18
|
+
#
|
19
|
+
# The {Client} class provides one method for each API operation. Operation
|
20
|
+
# methods each accept a hash of request parameters and return a response
|
21
|
+
# structure.
|
22
|
+
{{#example_operation_name}}
|
23
|
+
#
|
24
|
+
# {{example_var_name}} = {{module_name}}::Client.new
|
25
|
+
# resp = {{example_var_name}}.{{example_operation_name}}(params)
|
26
|
+
{{/example_operation_name}}
|
27
|
+
#
|
28
|
+
# See {Client} for more information.
|
29
|
+
#
|
30
|
+
# # Errors
|
31
|
+
#
|
32
|
+
# Errors returned from {{full_name}} are defined in the
|
33
|
+
# {Errors} module and all extend {Errors::ServiceError}.
|
34
|
+
#
|
35
|
+
# begin
|
36
|
+
# # do stuff
|
37
|
+
# rescue {{module_name}}::Errors::ServiceError
|
38
|
+
# # rescues all {{full_name}} API errors
|
39
|
+
# end
|
40
|
+
#
|
41
|
+
# See {Errors} for more information.
|
42
|
+
#
|
43
|
+
# @service
|
44
|
+
module {{module_name}}
|
45
|
+
|
46
|
+
GEM_VERSION = '{{gem_version}}'
|
47
|
+
|
48
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
{{#generated_src_warning}}
|
4
|
+
{{generated_src_warning}}
|
5
|
+
{{/generated_src_warning}}
|
6
|
+
require_relative '../../aws-sdk-core/spec/shared_spec_helper'
|
7
|
+
|
8
|
+
$:.unshift(File.expand_path('../../lib', __FILE__))
|
9
|
+
{{#gem_dependencies}}
|
10
|
+
$:.unshift(File.expand_path('../../../{{dependency}}/lib', __FILE__))
|
11
|
+
{{/gem_dependencies}}
|
12
|
+
|
13
|
+
require 'rspec'
|
14
|
+
require 'webmock/rspec'
|
15
|
+
require '{{gem_name}}'
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
{{#generated_src_warning}}
|
4
|
+
{{generated_src_warning}}
|
5
|
+
{{/generated_src_warning}}
|
6
|
+
module {{module_name}}
|
7
|
+
module Types
|
8
|
+
{{#structures}}
|
9
|
+
|
10
|
+
{{> documentation}}
|
11
|
+
{{#empty?}}
|
12
|
+
class {{class_name}} < Aws::EmptyStructure; end
|
13
|
+
{{/empty?}}
|
14
|
+
{{^empty?}}
|
15
|
+
class {{class_name}} < Struct.new(
|
16
|
+
{{#members}}
|
17
|
+
:{{member_name}}{{^last}},{{/last}}{{#last}}){{/last}}
|
18
|
+
{{/members}}
|
19
|
+
SENSITIVE = {{sensitive_params}}
|
20
|
+
include Aws::Structure
|
21
|
+
end
|
22
|
+
{{/empty?}}
|
23
|
+
{{/structures}}
|
24
|
+
{{#eventstreams}}
|
25
|
+
|
26
|
+
{{> documentation}}
|
27
|
+
class {{class_name}} < Enumerator
|
28
|
+
|
29
|
+
def event_types
|
30
|
+
{{#empty?}}
|
31
|
+
[]
|
32
|
+
{{/empty?}}
|
33
|
+
{{^empty?}}
|
34
|
+
[
|
35
|
+
{{#types}}
|
36
|
+
:{{member_name}}{{^last}},{{/last}}
|
37
|
+
{{/types}}
|
38
|
+
]
|
39
|
+
{{/empty?}}
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
{{/eventstreams}}
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
{{version}}
|
@@ -0,0 +1,112 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
{{#generated_src_warning}}
|
4
|
+
{{generated_src_warning}}
|
5
|
+
{{/generated_src_warning}}
|
6
|
+
require 'aws-sdk-core/waiters'
|
7
|
+
|
8
|
+
module {{module_name}}
|
9
|
+
{{#waiters?}}
|
10
|
+
# Waiters are utility methods that poll for a particular state to occur
|
11
|
+
# on a client. Waiters can fail after a number of attempts at a polling
|
12
|
+
# interval defined for the service client.
|
13
|
+
#
|
14
|
+
# For a list of operations that can be waited for and the
|
15
|
+
# client methods called for each operation, see the table below or the
|
16
|
+
# {Client#wait_until} field documentation for the {Client}.
|
17
|
+
#
|
18
|
+
# # Invoking a Waiter
|
19
|
+
# To invoke a waiter, call #wait_until on a {Client}. The first parameter
|
20
|
+
# is the waiter name, which is specific to the service client and indicates
|
21
|
+
# which operation is being waited for. The second parameter is a hash of
|
22
|
+
# parameters that are passed to the client method called by the waiter,
|
23
|
+
# which varies according to the waiter name.
|
24
|
+
#
|
25
|
+
# # Wait Failures
|
26
|
+
# To catch errors in a waiter, use WaiterFailed,
|
27
|
+
# as shown in the following example.
|
28
|
+
#
|
29
|
+
# rescue rescue Aws::Waiters::Errors::WaiterFailed => error
|
30
|
+
# puts "failed waiting for instance running: #{error.message}
|
31
|
+
# end
|
32
|
+
#
|
33
|
+
# # Configuring a Waiter
|
34
|
+
# Each waiter has a default polling interval and a maximum number of
|
35
|
+
# attempts it will make before returning control to your program.
|
36
|
+
# To set these values, use the `max_attempts` and `delay` parameters
|
37
|
+
# in your `#wait_until` call.
|
38
|
+
# The following example waits for up to 25 seconds, polling every five seconds.
|
39
|
+
#
|
40
|
+
# client.wait_until(...) do |w|
|
41
|
+
# w.max_attempts = 5
|
42
|
+
# w.delay = 5
|
43
|
+
# end
|
44
|
+
#
|
45
|
+
# To disable wait failures, set the value of either of these parameters
|
46
|
+
# to `nil`.
|
47
|
+
#
|
48
|
+
# # Extending a Waiter
|
49
|
+
# To modify the behavior of waiters, you can register callbacks that are
|
50
|
+
# triggered before each polling attempt and before waiting.
|
51
|
+
#
|
52
|
+
# The following example implements an exponential backoff in a waiter
|
53
|
+
# by doubling the amount of time to wait on every attempt.
|
54
|
+
#
|
55
|
+
# client.wait_until(...) do |w|
|
56
|
+
# w.interval = 0 # disable normal sleep
|
57
|
+
# w.before_wait do |n, resp|
|
58
|
+
# sleep(n ** 2)
|
59
|
+
# end
|
60
|
+
# end
|
61
|
+
#
|
62
|
+
# # Available Waiters
|
63
|
+
#
|
64
|
+
# The following table lists the valid waiter names, the operations they call,
|
65
|
+
# and the default `:delay` and `:max_attempts` values.
|
66
|
+
#
|
67
|
+
{{#waiters_markdown_table}}
|
68
|
+
{{#lines}}
|
69
|
+
# {{{.}}}{{/lines}}
|
70
|
+
{{/waiters_markdown_table}}
|
71
|
+
#
|
72
|
+
{{/waiters?}}
|
73
|
+
module Waiters
|
74
|
+
{{#waiters}}
|
75
|
+
|
76
|
+
{{> documentation}}
|
77
|
+
class {{class_name}}
|
78
|
+
|
79
|
+
# @param [Hash] options
|
80
|
+
# @option options [required, Client] :client
|
81
|
+
# @option options [Integer] :max_attempts ({{max_attempts}})
|
82
|
+
# @option options [Integer] :delay ({{delay}})
|
83
|
+
# @option options [Proc] :before_attempt
|
84
|
+
# @option options [Proc] :before_wait
|
85
|
+
def initialize(options)
|
86
|
+
@client = options.fetch(:client)
|
87
|
+
@waiter = Aws::Waiters::Waiter.new({
|
88
|
+
max_attempts: {{max_attempts}},
|
89
|
+
delay: {{delay}},
|
90
|
+
poller: Aws::Waiters::Poller.new(
|
91
|
+
operation_name: :{{client_method}},
|
92
|
+
{{#acceptors}}
|
93
|
+
{{#lines}}
|
94
|
+
{{{.}}}{{/lines}}
|
95
|
+
{{/acceptors}}
|
96
|
+
)
|
97
|
+
}.merge(options))
|
98
|
+
end
|
99
|
+
|
100
|
+
# @option (see Client#{{client_method}})
|
101
|
+
# @return (see Client#{{client_method}})
|
102
|
+
def wait(params = {})
|
103
|
+
@waiter.wait(client: @client, params: params)
|
104
|
+
end
|
105
|
+
|
106
|
+
# @api private
|
107
|
+
attr_reader :waiter
|
108
|
+
|
109
|
+
end
|
110
|
+
{{/waiters}}
|
111
|
+
end
|
112
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-sdk-code-generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amazon Web Services
|
@@ -9,7 +9,35 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2020-06-24 00:00:00.000000000 Z
|
12
|
-
dependencies:
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: kramdown
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: mustache
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
13
41
|
description: Generates the service code for the AWS SDK for Ruby
|
14
42
|
email:
|
15
43
|
- trevrowe@amazon.com
|
@@ -87,6 +115,29 @@ files:
|
|
87
115
|
- lib/aws-sdk-code-generator/views/waiters_module.rb
|
88
116
|
- lib/aws-sdk-code-generator/waiter.rb
|
89
117
|
- lib/aws-sdk-code-generator/yard_option_tag.rb
|
118
|
+
- templates/apig_endpoint_class.mustache
|
119
|
+
- templates/apig_readme.mustache
|
120
|
+
- templates/async_client_class.mustache
|
121
|
+
- templates/authorizer_class.mustache
|
122
|
+
- templates/client_api_module.mustache
|
123
|
+
- templates/client_class.mustache
|
124
|
+
- templates/code.mustache
|
125
|
+
- templates/documentation.mustache
|
126
|
+
- templates/errors_module.mustache
|
127
|
+
- templates/event_streams_module.mustache
|
128
|
+
- templates/features/env.mustache
|
129
|
+
- templates/features/smoke.mustache
|
130
|
+
- templates/features/smoke_step_definitions.mustache
|
131
|
+
- templates/features/step_definitions.mustache
|
132
|
+
- templates/gemspec.mustache
|
133
|
+
- templates/method.mustache
|
134
|
+
- templates/resource_class.mustache
|
135
|
+
- templates/root_resource_class.mustache
|
136
|
+
- templates/service_module.mustache
|
137
|
+
- templates/spec/spec_helper.mustache
|
138
|
+
- templates/types_module.mustache
|
139
|
+
- templates/version.mustache
|
140
|
+
- templates/waiters_module.mustache
|
90
141
|
homepage: https://github.com/aws/aws-sdk-ruby
|
91
142
|
licenses:
|
92
143
|
- Apache-2.0
|