diff --git a/fog-azure.gemspec b/fog-azure.gemspec index 06f66f3..97bbfa6 100644 --- a/fog-azure.gemspec +++ b/fog-azure.gemspec @@ -48,5 +48,5 @@ Gem::Specification.new do |spec| spec.add_dependency 'fog-core', '~> 1.27' spec.add_dependency 'fog-json', '~> 1.0' spec.add_dependency 'fog-xml', '~> 0.1' - spec.add_dependency 'azure', '~>0.6' + spec.add_dependency 'azure', '~>0.7.0.pre' end diff --git a/lib/fog/azure/compute.rb b/lib/fog/azure/compute.rb index 80b269c..eb09b3b 100644 --- a/lib/fog/azure/compute.rb +++ b/lib/fog/azure/compute.rb @@ -45,6 +45,7 @@ class Azure < Fog::Service request :create_database_server request :delete_database request :firewall_rules + request :role_sizes model_path "fog/azure/models/compute" model :server @@ -85,6 +86,7 @@ def initialize(options) @stg_svc = ::Azure::StorageManagementService.new @image_svc = ::Azure::VirtualMachineImageManagementService.new @db_svc = ::Azure::SqlDatabaseManagementService.new + @base_svc = ::Azure::BaseManagementService.new end end end diff --git a/lib/fog/azure/docs/getting_started.md b/lib/fog/azure/docs/getting_started.md index c493e23..ba7df2c 100644 --- a/lib/fog/azure/docs/getting_started.md +++ b/lib/fog/azure/docs/getting_started.md @@ -24,7 +24,7 @@ azure = Fog::Compute.new( :provider => 'Azure', :azure_sub_id => '35a2461c-22ac-1111-5ed2-11165d755ba4', :azure_pem => 'c:/path/abc.pem', - :azure_api_url => 'usnorth.management.core.windows.net' + :azure_api_url => 'management.core.windows.net' ) ``` @@ -58,7 +58,28 @@ server = azure.servers.create( :storage_account_name => 'fogstorage' ) ``` - +Following key value pairs can be used while creating a server. + +| key | Description of values | Example | +| --------------------- |:----------------------------------------------------------------:|:-------------------------------------------------------------------- | +| :vm_name | Name of the VM to be given. It should be unique. | "fog-server" | +| :vm_user | User name for the VM | "foguser" | +| :image | Image to be used for creation of VM. | "0b11de9248dd4d87b18621318e037d37__RightImage-Ubuntu-12.04-x64-v13.4"| +| :password | Password to be used for authenticating above User name. | "password@123" | +| :location | Data center location to be used for creation of VM. | "West Europe" | +| :storage_account_name | Storage account to be used for creation of VM.(Optional) | "fog-storage" | +| :winrm_transport | Winrm transport protocol either 'http' or 'https'.(Optional) | "https" or "http" | +| :cloud_service_name | Cloud service name.(Optional) | "fog-server" | +| :deployment_name | Deployment name.(Optional) | "fog-server" | +| :tcp_endpoints | Tcp end point.It should be comma separated list in the format (publicport):(privateport).(Optional) | "80:8081,443:9443" | +| :private_key_file | Path of private key file.(Optional) | "c:/path/id_rsa" | +| :certificate_file | Path of certificate file.(Optional) | "c:/path/cert.cert" | +| :ssh_port | Ssh port to be used.(Optional) | "25" | +| :vm_size | Vm/Role size.(Optional) | "Standard_A1" | +| :affinity_group_name | Affinity group name.(Optional) | "fog-server-group" | +| :virtual_network_name | Virtual network name.(Optional) | "fog-server-network" | +| :subnet_name | Subnet name.(Optional) | "fog-server-subnet" | +| :availability_set_name| Availability set name.(Optional) | "fog-server-availability" | ## Retrieve a single record @@ -162,3 +183,12 @@ image.locations image.category image.os_type ``` + +## Listing rolesizes + +```ruby +azure.role_sizes.each do | role_size| +puts role_size +end +``` + diff --git a/lib/fog/azure/requests/compute/role_sizes.rb b/lib/fog/azure/requests/compute/role_sizes.rb new file mode 100644 index 0000000..0f1119f --- /dev/null +++ b/lib/fog/azure/requests/compute/role_sizes.rb @@ -0,0 +1,18 @@ +module Fog + module Compute + class Azure + class Real + def role_sizes + @base_svc.list_role_sizes + end + end + + class Mock + def role_sizes + role_sizes = ["A10", "A11", "A5", "A6", "A7", "A8", "A9", "Basic_A0", "Basic_A1", "Basic_A2", "Basic_A3", "Basic_A4", "ExtraLarge", "ExtraSmall", "Large", "Medium", "Small", "Standard_D1", "Standard_D11", "Standard_D12", "Standard_D13", "Standard_D14", "Standard_D2", "Standard_D3", "Standard_D4", "Standard_DS1", "Standard_DS11", "Standard_DS12", "Standard_DS13", "Standard_DS14", "Standard_DS2", "Standard_DS3", "Standard_DS4", "Standard_G1", "Standard_G2", "Standard_G3", "Standard_G4", "Standard_G5"] + role_sizes + end + end + end + end +end diff --git a/tests/requests/compute/role_sizes_tests.rb b/tests/requests/compute/role_sizes_tests.rb new file mode 100644 index 0000000..7482d8c --- /dev/null +++ b/tests/requests/compute/role_sizes_tests.rb @@ -0,0 +1,36 @@ +# Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +Shindo.tests("Fog::Compute[:azure] | role_sizes request", ["azure", "compute"]) do + + tests("#role_sizes") do + role_sizes = Fog::Compute[:azure].role_sizes + + test "returns an Array of strings" do + role_sizes.is_a? Array + end + + test("should return records") do + role_sizes.size >= 1 + end + + end +end