lib/cloudstrap/amazon/ec2.rb in cloudstrap-0.30.3.pre vs lib/cloudstrap/amazon/ec2.rb in cloudstrap-0.30.11.pre
- old
+ new
@@ -375,9 +375,29 @@
.select { |tag| type.nil? || tag.resource_type == type }
.select { |tag| tag.key == (key || 'Name') }
.select { |tag| value.nil? || tag.value == value }
end
+ Contract None => ArrayOf[::Aws::EC2::Types::Region]
+ def regions
+ @regions ||= regions!
+ end
+
+ Contract None => ArrayOf[::Aws::EC2::Types::Region]
+ def regions!
+ @regions = call_api(:describe_regions).regions
+ end
+
+ Contract None => ArrayOf[String]
+ def region_names
+ regions.map(&:region_name)
+ end
+
+ Contract String => Bool
+ def valid_region?(region_name)
+ region_names.include? region_name
+ end
+
private
def client
Aws::EC2::Client
end