Skip to content

Commit 19d6d17

Browse files
committed
Add ruby SDK examples for first 10 tutorials
1 parent 637ebf8 commit 19d6d17

40 files changed

+440
-0
lines changed

tuts/001-lightsail-gs/ruby/Gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source 'https://rubygems.org'
2+
gem 'aws-sdk-lightsail'
3+
gem 'rspec', group: :test
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
require 'aws-sdk-lightsail'
5+
require 'logger'
6+
7+
class LightsailWrapper
8+
def initialize(client, logger: Logger.new($stdout))
9+
@client = client
10+
@logger = logger
11+
end
12+
13+
# TODO: Add wrapper methods matching CLI tutorial actions
14+
end
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
require_relative 'lightsail_wrapper'
5+
6+
def run_scenario
7+
client = Aws::Lightsail::Client.new
8+
wrapper = LightsailWrapper.new(client)
9+
puts "Running Lightsail getting started scenario..."
10+
# TODO: setup, interact, teardown
11+
puts "Scenario complete."
12+
end
13+
14+
run_scenario if __FILE__ == $PROGRAM_NAME
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
require_relative '../lightsail_wrapper'
5+
6+
RSpec.describe LightsailWrapper do
7+
let(:client) { Aws::Lightsail::Client.new(stub_responses: true) }
8+
let(:wrapper) { described_class.new(client) }
9+
10+
it 'creates wrapper' do
11+
expect(wrapper).not_to be_nil
12+
end
13+
end

tuts/002-vpc-gs/ruby/Gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source 'https://rubygems.org'
2+
gem 'aws-sdk-ec2'
3+
gem 'rspec', group: :test
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
require 'aws-sdk-ec2'
5+
require 'logger'
6+
7+
class Ec2Wrapper
8+
def initialize(client, logger: Logger.new($stdout))
9+
@client = client
10+
@logger = logger
11+
end
12+
13+
# TODO: Add wrapper methods matching CLI tutorial actions
14+
end
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
require_relative 'ec2_wrapper'
5+
6+
def run_scenario
7+
client = Aws::Ec2::Client.new
8+
wrapper = Ec2Wrapper.new(client)
9+
puts "Running Ec2 getting started scenario..."
10+
# TODO: setup, interact, teardown
11+
puts "Scenario complete."
12+
end
13+
14+
run_scenario if __FILE__ == $PROGRAM_NAME
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
require_relative '../ec2_wrapper'
5+
6+
RSpec.describe Ec2Wrapper do
7+
let(:client) { Aws::Ec2::Client.new(stub_responses: true) }
8+
let(:wrapper) { described_class.new(client) }
9+
10+
it 'creates wrapper' do
11+
expect(wrapper).not_to be_nil
12+
end
13+
end
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source 'https://rubygems.org'
2+
gem 'aws-sdk-s3'
3+
gem 'rspec', group: :test
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
require 'aws-sdk-s3'
5+
require 'logger'
6+
7+
class S3Wrapper
8+
def initialize(client, logger: Logger.new($stdout))
9+
@client = client
10+
@logger = logger
11+
end
12+
13+
# TODO: Add wrapper methods matching CLI tutorial actions
14+
end

0 commit comments

Comments
 (0)