mirror of
https://github.com/puppetlabs/vmpooler-provider-ec2.git
synced 2026-01-26 10:28:41 -05:00
Added aws dependency and renamed directories
rename gce to aws rename gce to aws rename gce to aws create_vm method implimented create_vm method connected to ec2 setup tags properly, and retireve then in get_vm begin disk and snapshop, but we dont have perms add specs for get_vm and vms_in_pool add spec for create_vm add spec for destroy_vm update readme add a new class lib/vmpooler/aws_setup.rb to do the provisioning of nodes adding spec tests adding net:ssh lib for the provisioning of nodes adding option to provision vm once ready fix aws_setup setup of nodes once running
This commit is contained in:
parent
78946ca2b9
commit
c3c1a8e1e5
21 changed files with 2650 additions and 1 deletions
110
spec/ec2_helper.rb
Normal file
110
spec/ec2_helper.rb
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# this file is used to Mock the GCE objects, for example the main ComputeService object
|
||||
MockResult = Struct.new(
|
||||
# https://googleapis.dev/ruby/google-api-client/latest/Google/Apis/ComputeV1/Operation.html
|
||||
:client_operation_id, :creation_timestamp, :description, :end_time, :error, :http_error_message,
|
||||
:http_error_status_code, :id, :insert_time, :kind, :name, :operation_type, :progress, :region,
|
||||
:self_link, :start_time, :status, :status_message, :target_id, :target_link, :user, :warnings, :zone,
|
||||
keyword_init: true
|
||||
)
|
||||
|
||||
MockOperationError = [].freeze
|
||||
|
||||
MockOperationErrorError = Struct.new(
|
||||
# https://googleapis.dev/ruby/google-api-client/latest/Google/Apis/ComputeV1/Operation/Error/Error.html
|
||||
:code, :location, :message,
|
||||
keyword_init: true
|
||||
)
|
||||
|
||||
MockInstance = Struct.new(
|
||||
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/EC2/Instance.html
|
||||
:instance_type, :launch_time, :private_ip_address, :state, :tags, :zone,
|
||||
keyword_init: true
|
||||
)
|
||||
|
||||
MockTag = Struct.new(
|
||||
:key, :value,
|
||||
keyword_init: true
|
||||
)
|
||||
|
||||
MockInstanceList = Struct.new(
|
||||
# https://googleapis.dev/ruby/google-api-client/latest/Google/Apis/ComputeV1/InstanceList.html
|
||||
:id, :items, :kind, :next_page_token, :self_link, :warning,
|
||||
keyword_init: true
|
||||
)
|
||||
|
||||
MockDiskList = Struct.new(
|
||||
# https://googleapis.dev/ruby/google-api-client/latest/Google/Apis/ComputeV1/DiskList.html
|
||||
:id, :items, :kind, :next_page_token, :self_link, :warning,
|
||||
keyword_init: true
|
||||
)
|
||||
|
||||
MockDisk = Struct.new(
|
||||
# https://googleapis.dev/ruby/google-api-client/latest/Google/Apis/ComputeV1/Disk.html
|
||||
:creation_timestamp, :description, :disk_encryption_key, :guest_os_features, :id, :kind, :label_fingerprint, :labels,
|
||||
:last_attach_timestamp, :last_detach_timestamp, :license_codes, :licenses, :name, :options,
|
||||
:physical_block_size_bytes, :region, :replica_zones, :resource_policies, :self_link, :size_gb, :source_disk,
|
||||
:source_disk_id, :source_image, :source_image_encryption_key, :source_image_id, :source_snapshot,
|
||||
:source_snapshot_encryption_key, :source_snapshot_id, :status, :type, :users, :zone,
|
||||
keyword_init: true
|
||||
)
|
||||
|
||||
MockSnapshotList = Struct.new(
|
||||
# https://googleapis.dev/ruby/google-api-client/latest/Google/Apis/ComputeV1/DiskList.html
|
||||
:id, :items, :kind, :next_page_token, :self_link, :warning,
|
||||
keyword_init: true
|
||||
)
|
||||
|
||||
MockSnapshot = Struct.new(
|
||||
# https://googleapis.dev/ruby/google-api-client/latest/Google/Apis/ComputeV1/Snapshot.html
|
||||
:auto_created, :chain_name, :creation_timestamp, :description, :disk_size_gb, :download_bytes, :id, :kind,
|
||||
:label_fingerprint, :labels, :license_codes, :licenses, :name, :self_link, :snapshot_encryption_key, :source_disk,
|
||||
:source_disk_encryption_key, :source_disk_id, :status, :storage_bytes, :storage_bytes_status, :storage_locations,
|
||||
keyword_init: true
|
||||
)
|
||||
|
||||
MockAttachedDisk = Struct.new(
|
||||
# https://googleapis.dev/ruby/google-api-client/latest/Google/Apis/ComputeV1/AttachedDisk.html
|
||||
:auto_delete, :boot, :device_name, :disk_encryption_key, :disk_size_gb, :guest_os_features, :index,
|
||||
:initialize_params, :interface, :kind, :licenses, :mode, :shielded_instance_initial_state, :source, :type,
|
||||
keyword_init: true
|
||||
)
|
||||
|
||||
# --------------------
|
||||
# Main ComputeService Object
|
||||
# --------------------
|
||||
MockComputeServiceConnection = Struct.new(
|
||||
# https://googleapis.dev/ruby/google-api-client/latest/Google/Apis/ComputeV1/ComputeService.html
|
||||
:key, :quota_user, :user_ip
|
||||
) do
|
||||
# Onlly methods we use are listed here
|
||||
def get_instance
|
||||
MockInstance.new
|
||||
end
|
||||
|
||||
# Alias to serviceContent.propertyCollector
|
||||
def insert_instance
|
||||
MockResult.new
|
||||
end
|
||||
end
|
||||
|
||||
# -------------------------------------------------------------------------------------------------------------
|
||||
# Mocking Methods
|
||||
# -------------------------------------------------------------------------------------------------------------
|
||||
|
||||
# def mock_RbVmomi_VIM_ClusterComputeResource(options = {})
|
||||
# options[:name] = 'Cluster' + rand(65536).to_s if options[:name].nil?
|
||||
#
|
||||
# mock = MockClusterComputeResource.new()
|
||||
#
|
||||
# mock.name = options[:name]
|
||||
# # All cluster compute resources have a root Resource Pool
|
||||
# mock.resourcePool = mock_RbVmomi_VIM_ResourcePool({:name => options[:name]})
|
||||
#
|
||||
# allow(mock).to receive(:is_a?) do |expected_type|
|
||||
# expected_type == RbVmomi::VIM::ClusterComputeResource
|
||||
# end
|
||||
#
|
||||
# mock
|
||||
# end
|
||||
Loading…
Add table
Add a link
Reference in a new issue