Class: Azure::Armrest::VirtualMachineImageService
- Inherits:
-
ArmrestService
- Object
- ArmrestService
- Azure::Armrest::VirtualMachineImageService
- Defined in:
- lib/azure/armrest/virtual_machine_image_service.rb
Overview
Base class for managing virtual machine images
Instance Attribute Summary collapse
-
#location ⇒ Object
The location used in requests when gathering VM image information.
-
#publisher ⇒ Object
The publisher used in requests when gathering VM image information.
Attributes inherited from ArmrestService
#api_version, #armrest_configuration, #base_url, #provider
Instance Method Summary collapse
-
#initialize(configuration, options = {}) ⇒ VirtualMachineImageService
constructor
Create and return a new VirtualMachineImageService instance.
-
#offers(location = @location, publisher = @publisher) ⇒ Object
Return a list of VM image offers from the given
publisherandlocation. -
#publishers(location = @location) ⇒ Object
Return a list of VM image publishers for the given
location. -
#skus(offer, location = @location, publisher = @publisher) ⇒ Object
Return a list of VM image skus for the given
offer,location, andpublisher. -
#versions(sku, offer, location = @location, publisher = @publisher) ⇒ Object
Return a list of VM image versions for the given
sku,offer,locationandpublisher.
Methods inherited from ArmrestService
configure, #get_provider, #get_subscription, #list_resource_groups, #list_resources, #list_subscriptions, #locations, #tags, #tenants
Constructor Details
#initialize(configuration, options = {}) ⇒ VirtualMachineImageService
Create and return a new VirtualMachineImageService instance.
This subclass accepts the additional :location, :provider, and :publisher options as well.
18 19 20 21 22 23 |
# File 'lib/azure/armrest/virtual_machine_image_service.rb', line 18 def initialize(configuration, = {}) super(configuration, 'locations/publishers', 'Microsoft.Compute', ) @location = [:location] @publisher = [:publisher] end |
Instance Attribute Details
#location ⇒ Object
The location used in requests when gathering VM image information.
8 9 10 |
# File 'lib/azure/armrest/virtual_machine_image_service.rb', line 8 def location @location end |
#publisher ⇒ Object
The publisher used in requests when gathering VM image information.
11 12 13 |
# File 'lib/azure/armrest/virtual_machine_image_service.rb', line 11 def publisher @publisher end |
Instance Method Details
#offers(location = @location, publisher = @publisher) ⇒ Object
Return a list of VM image offers from the given publisher and location.
Example:
vmis.offers('eastus', 'Canonical')
31 32 33 34 35 36 37 38 |
# File 'lib/azure/armrest/virtual_machine_image_service.rb', line 31 def offers(location = @location, publisher = @publisher) raise ArgumentError, "No location specified" unless location raise ArgumentError, "No publisher specified" unless publisher url = build_url(location, 'publishers', publisher, 'artifacttypes', 'vmimage', 'offers') JSON.parse(rest_get(url)).map { |hash| Azure::Armrest::Offer.new(hash) } end |
#publishers(location = @location) ⇒ Object
Return a list of VM image publishers for the given location.
Example:
vmis.publishers('eastus')
46 47 48 49 50 51 52 |
# File 'lib/azure/armrest/virtual_machine_image_service.rb', line 46 def publishers(location = @location) raise ArgumentError, "No location specified" unless location url = build_url(location, 'publishers') JSON.parse(rest_get(url)).map { |hash| Azure::Armrest::Publisher.new(hash) } end |
#skus(offer, location = @location, publisher = @publisher) ⇒ Object
Return a list of VM image skus for the given offer, location, and publisher.
Example:
vmis.skus('UbuntuServer', 'eastus', 'Canonical')
61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/azure/armrest/virtual_machine_image_service.rb', line 61 def skus(offer, location = @location, publisher = @publisher) raise ArgumentError, "No location specified" unless location raise ArgumentError, "No publisher specified" unless publisher url = build_url( location, 'publishers', publisher, 'artifacttypes', 'vmimage', 'offers', offer, 'skus' ) JSON.parse(rest_get(url)).map { |hash| Azure::Armrest::Sku.new(hash) } end |
#versions(sku, offer, location = @location, publisher = @publisher) ⇒ Object
Return a list of VM image versions for the given sku, offer, location and publisher.
Example:
vmis.versions('15.10', 'UbuntuServer', 'eastus', 'Canonical').map(&:name)
# sample output
=> ["15.10.201511111", "15.10.201511161", "15.10.201512030"]
83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/azure/armrest/virtual_machine_image_service.rb', line 83 def versions(sku, offer, location = @location, publisher = @publisher) raise ArgumentError, "No location specified" unless location raise ArgumentError, "No publisher specified" unless publisher url = build_url( location, 'publishers', publisher, 'artifacttypes', 'vmimage', 'offers', offer, 'skus', sku, 'versions' ) JSON.parse(rest_get(url)).map { |hash| Azure::Armrest::ImageVersion.new(hash) } end |