azure-armrest 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/CHANGES +10 -0
 - data/lib/azure/armrest/armrest_collection.rb +9 -0
 - data/lib/azure/armrest/armrest_service.rb +13 -4
 - data/lib/azure/armrest/insights/event_service.rb +35 -7
 - data/lib/azure/armrest/insights/metrics_service.rb +59 -0
 - data/lib/azure/armrest/model/base_model.rb +5 -0
 - data/lib/azure/armrest/version.rb +1 -1
 - data/lib/azure/armrest/virtual_machine_image_service.rb +14 -18
 - data/lib/azure/armrest.rb +2 -0
 - metadata +4 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 46e8ae9e1b26fc145c1e030083f6a37ec0873e68
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 23c5fbe41693e3e7d9ba42d91c3fa9da85692e0d
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: c4211477e10c08afe35c587f1f7d6d95505f58ac1f3bcb56b44582459f75cecd2dae7456bb5e78ceca2e2beaa1f21617f4ae530049faa909a50ff7b29d7e2f82
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: c2550408054f12e2ecf56204f5413892d2de5c1501b69ce819cc8c28930cc72b27508f9e617f48ec68f039ddfcc91fa0b14d5a659940b6e411c9e73143461162
         
     | 
    
        data/CHANGES
    CHANGED
    
    | 
         @@ -1,3 +1,13 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            = 0.2.3 - 29-Mar-2016
         
     | 
| 
      
 2 
     | 
    
         
            +
            * Fixed the VirtualMachineImageService class.
         
     | 
| 
      
 3 
     | 
    
         
            +
            * Added an Insights::MetricsService class and support models.
         
     | 
| 
      
 4 
     | 
    
         
            +
            * Added a singleton method to clear some internal class variable caches that
         
     | 
| 
      
 5 
     | 
    
         
            +
              we use. This is primarily meant for testing.
         
     | 
| 
      
 6 
     | 
    
         
            +
            * Added a customs collection class that will eventually be used for better
         
     | 
| 
      
 7 
     | 
    
         
            +
              handling of skip tokens (paging).
         
     | 
| 
      
 8 
     | 
    
         
            +
            * Updated the Insights::Event class, modifying the list method's prototype,
         
     | 
| 
      
 9 
     | 
    
         
            +
              and now it returns our custom collection class.
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
       1 
11 
     | 
    
         
             
            = 0.2.2 - 16-Mar-2016
         
     | 
| 
       2 
12 
     | 
    
         
             
            * Fixed a potential name collision issue for nested objects.
         
     | 
| 
       3 
13 
     | 
    
         | 
| 
         @@ -84,11 +84,14 @@ module Azure 
     | 
|
| 
       84 
84 
     | 
    
         
             
                  # The SSL version used for each request. The default is TLSv1.
         
     | 
| 
       85 
85 
     | 
    
         
             
                  attr_accessor :ssl_version
         
     | 
| 
       86 
86 
     | 
    
         | 
| 
       87 
     | 
    
         
            -
                   
     | 
| 
       88 
     | 
    
         
            -
             
     | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
      
 87 
     | 
    
         
            +
                  # Clear class level caches.
         
     | 
| 
      
 88 
     | 
    
         
            +
                  def self.clear_caches
         
     | 
| 
      
 89 
     | 
    
         
            +
                    @@providers_hash = {} # Set in constructor
         
     | 
| 
      
 90 
     | 
    
         
            +
                    @@tokens         = {} # token caches
         
     | 
| 
      
 91 
     | 
    
         
            +
                    @@subscriptions  = {} # subscription caches
         
     | 
| 
      
 92 
     | 
    
         
            +
                  end
         
     | 
| 
       90 
93 
     | 
    
         | 
| 
       91 
     | 
    
         
            -
                   
     | 
| 
      
 94 
     | 
    
         
            +
                  clear_caches
         
     | 
| 
       92 
95 
     | 
    
         | 
| 
       93 
96 
     | 
    
         
             
                  # Create a configuration object based on input options.
         
     | 
| 
       94 
97 
     | 
    
         
             
                  # This object can be used to create service objects.
         
     | 
| 
         @@ -498,6 +501,12 @@ module Azure 
     | 
|
| 
       498 
501 
     | 
    
         
             
                        configuration.api_version
         
     | 
| 
       499 
502 
     | 
    
         
             
                      end
         
     | 
| 
       500 
503 
     | 
    
         
             
                  end
         
     | 
| 
      
 504 
     | 
    
         
            +
             
     | 
| 
      
 505 
     | 
    
         
            +
                  # Parse the skip token value out of the nextLink attribute from a response.
         
     | 
| 
      
 506 
     | 
    
         
            +
                  def parse_skip_token(json)
         
     | 
| 
      
 507 
     | 
    
         
            +
                    return nil unless json['nextLink']
         
     | 
| 
      
 508 
     | 
    
         
            +
                    json['nextLink'][/.*?skipToken=(.*?)$/i, 1]
         
     | 
| 
      
 509 
     | 
    
         
            +
                  end
         
     | 
| 
       501 
510 
     | 
    
         
             
                end # ArmrestService
         
     | 
| 
       502 
511 
     | 
    
         
             
              end # Armrest
         
     | 
| 
       503 
512 
     | 
    
         
             
            end # Azure
         
     | 
| 
         @@ -14,6 +14,7 @@ module Azure 
     | 
|
| 
       14 
14 
     | 
    
         
             
                    end
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         
             
                    # Returns a list of management events for the current subscription.
         
     | 
| 
      
 17 
     | 
    
         
            +
                    #
         
     | 
| 
       17 
18 
     | 
    
         
             
                    # The +filter+ option can be used to filter the result set. Additionally,
         
     | 
| 
       18 
19 
     | 
    
         
             
                    # you may restrict the results to only return certain fields using
         
     | 
| 
       19 
20 
     | 
    
         
             
                    # the +select+ option. The possible fields for both filtering and selection
         
     | 
| 
         @@ -24,6 +25,17 @@ module Azure 
     | 
|
| 
       24 
25 
     | 
    
         
             
                    # operationName, properties, resourceGroupName, resourceProviderName,
         
     | 
| 
       25 
26 
     | 
    
         
             
                    # resourceUri, status, submissionTimestamp, subStatus and subscriptionId.
         
     | 
| 
       26 
27 
     | 
    
         
             
                    #
         
     | 
| 
      
 28 
     | 
    
         
            +
                    # The +skip_token+ option can be used to grab the next batch of events
         
     | 
| 
      
 29 
     | 
    
         
            +
                    # when the first call reaches the maximum number of events that the API
         
     | 
| 
      
 30 
     | 
    
         
            +
                    # can return in one batch (API default 200). You may also set the :all
         
     | 
| 
      
 31 
     | 
    
         
            +
                    # option to true, in which case all batches will automatically be
         
     | 
| 
      
 32 
     | 
    
         
            +
                    # collected for you.
         
     | 
| 
      
 33 
     | 
    
         
            +
                    #
         
     | 
| 
      
 34 
     | 
    
         
            +
                    # In practice you should always set a filter for eventTimestamp because
         
     | 
| 
      
 35 
     | 
    
         
            +
                    # you are restricted to 90 days worth of events. If you do not set the
         
     | 
| 
      
 36 
     | 
    
         
            +
                    # filter and/or you try to retrieve more than 90 days worth of events
         
     | 
| 
      
 37 
     | 
    
         
            +
                    # then you will get an error. This is a limitation of the Azure API.
         
     | 
| 
      
 38 
     | 
    
         
            +
                    #
         
     | 
| 
       27 
39 
     | 
    
         
             
                    # Example:
         
     | 
| 
       28 
40 
     | 
    
         
             
                    #
         
     | 
| 
       29 
41 
     | 
    
         
             
                    #   ies = Azure::Armrest::Insights::EventService.new(conf)
         
     | 
| 
         @@ -32,19 +44,34 @@ module Azure 
     | 
|
| 
       32 
44 
     | 
    
         
             
                    #   filter = "eventTimestamp ge #{date} and eventChannels eq 'Admin, Operation'"
         
     | 
| 
       33 
45 
     | 
    
         
             
                    #   select = "resourceGroupName, operationName"
         
     | 
| 
       34 
46 
     | 
    
         
             
                    #
         
     | 
| 
       35 
     | 
    
         
            -
                    #   ies.list(filter, select).each{ |event|
         
     | 
| 
      
 47 
     | 
    
         
            +
                    #   ies.list(:filter => filter, :select => select, :all => true).events.each{ |event|
         
     | 
| 
       36 
48 
     | 
    
         
             
                    #     p event
         
     | 
| 
       37 
49 
     | 
    
         
             
                    #   }
         
     | 
| 
       38 
50 
     | 
    
         
             
                    #
         
     | 
| 
       39 
     | 
    
         
            -
                    def list( 
     | 
| 
       40 
     | 
    
         
            -
                      url = build_url( 
     | 
| 
      
 51 
     | 
    
         
            +
                    def list(options = {})
         
     | 
| 
      
 52 
     | 
    
         
            +
                      url = build_url(options)
         
     | 
| 
       41 
53 
     | 
    
         
             
                      response = rest_get(url)
         
     | 
| 
       42 
     | 
    
         
            -
                      JSON.parse(response.body) 
     | 
| 
      
 54 
     | 
    
         
            +
                      json_response = JSON.parse(response.body)
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
                      events = ArmrestCollection.new(
         
     | 
| 
      
 57 
     | 
    
         
            +
                        json_response['value'].map do |hash|
         
     | 
| 
      
 58 
     | 
    
         
            +
                          Azure::Armrest::Insights::Event.new(hash)
         
     | 
| 
      
 59 
     | 
    
         
            +
                        end
         
     | 
| 
      
 60 
     | 
    
         
            +
                      )
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
                      events.skip_token = parse_skip_token(json_response)
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
                      if options[:all] && events.skip_token
         
     | 
| 
      
 65 
     | 
    
         
            +
                        events.push(*list(options.merge(:skip_token => events.skip_token)))
         
     | 
| 
      
 66 
     | 
    
         
            +
                        events.skip_token = nil # Clear when finished
         
     | 
| 
      
 67 
     | 
    
         
            +
                      end
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
      
 69 
     | 
    
         
            +
                      events
         
     | 
| 
       43 
70 
     | 
    
         
             
                    end
         
     | 
| 
       44 
71 
     | 
    
         | 
| 
       45 
72 
     | 
    
         
             
                    private
         
     | 
| 
       46 
73 
     | 
    
         | 
| 
       47 
     | 
    
         
            -
                    def build_url( 
     | 
| 
      
 74 
     | 
    
         
            +
                    def build_url(options = {})
         
     | 
| 
       48 
75 
     | 
    
         
             
                      sub_id = armrest_configuration.subscription_id
         
     | 
| 
       49 
76 
     | 
    
         | 
| 
       50 
77 
     | 
    
         
             
                      url =
         
     | 
| 
         @@ -59,8 +86,9 @@ module Azure 
     | 
|
| 
       59 
86 
     | 
    
         
             
                        )
         
     | 
| 
       60 
87 
     | 
    
         | 
| 
       61 
88 
     | 
    
         
             
                      url << "?api-version=#{@api_version}"
         
     | 
| 
       62 
     | 
    
         
            -
                      url << "&$filter=#{filter}" if filter
         
     | 
| 
       63 
     | 
    
         
            -
                      url << "&$select=#{select}" if select
         
     | 
| 
      
 89 
     | 
    
         
            +
                      url << "&$filter=#{options[:filter]}" if options[:filter]
         
     | 
| 
      
 90 
     | 
    
         
            +
                      url << "&$select=#{options[:select]}" if options[:select]
         
     | 
| 
      
 91 
     | 
    
         
            +
                      url << "&$skipToken=#{options[:skip_token]}" if options[:skip_token]
         
     | 
| 
       64 
92 
     | 
    
         | 
| 
       65 
93 
     | 
    
         
             
                      url
         
     | 
| 
       66 
94 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -0,0 +1,59 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Azure
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Armrest
         
     | 
| 
      
 3 
     | 
    
         
            +
                module Insights
         
     | 
| 
      
 4 
     | 
    
         
            +
                  class MetricsService < ArmrestService
         
     | 
| 
      
 5 
     | 
    
         
            +
                    # Creates and returns a new MetricsService object.
         
     | 
| 
      
 6 
     | 
    
         
            +
                    #
         
     | 
| 
      
 7 
     | 
    
         
            +
                    def initialize(armrest_configuration, options = {})
         
     | 
| 
      
 8 
     | 
    
         
            +
                      options['api_version'] = '2014-04-01' # Must hard code for now
         
     | 
| 
      
 9 
     | 
    
         
            +
                      super(armrest_configuration, 'metricDefinitions', 'Microsoft.Insights', options)
         
     | 
| 
      
 10 
     | 
    
         
            +
                    end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                    # Return the metric definitions for the given +provider+, +resource_type+,
         
     | 
| 
      
 13 
     | 
    
         
            +
                    # and +resource_name+ for +resource_group+. You may pass a :filter option as well.
         
     | 
| 
      
 14 
     | 
    
         
            +
                    #
         
     | 
| 
      
 15 
     | 
    
         
            +
                    # Example:
         
     | 
| 
      
 16 
     | 
    
         
            +
                    #
         
     | 
| 
      
 17 
     | 
    
         
            +
                    #   metrics = Azure::Armrest::Insights::MetricsService.new(conf)
         
     | 
| 
      
 18 
     | 
    
         
            +
                    #
         
     | 
| 
      
 19 
     | 
    
         
            +
                    #   metrics.list('Microsoft.SQL', 'servers', 'myServer/databases/myDB', 'mygroup')
         
     | 
| 
      
 20 
     | 
    
         
            +
                    #   metrics.list('Microsoft.Compute', 'virtualMachines', 'myVm', 'mygroup')
         
     | 
| 
      
 21 
     | 
    
         
            +
                    #
         
     | 
| 
      
 22 
     | 
    
         
            +
                    def list(provider, resource_type, resource_name, resource_group = nil, options = {})
         
     | 
| 
      
 23 
     | 
    
         
            +
                      resource_group ||= configuration.resource_group
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                      raise ArgumentError, "no resource group provided" unless resource_group
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                      url = build_url(provider, resource_type, resource_name, resource_group, options)
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                      response = rest_get(url)
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                      JSON.parse(response)['value'].map { |hash| Azure::Armrest::Insights::Metric.new(hash) }
         
     | 
| 
      
 32 
     | 
    
         
            +
                    end
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                    private
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                    def build_url(provider, resource_type, resource_name, resource_group, options)
         
     | 
| 
      
 37 
     | 
    
         
            +
                      sub_id = configuration.subscription_id
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                      url = File.join(
         
     | 
| 
      
 40 
     | 
    
         
            +
                        Azure::Armrest::COMMON_URI,
         
     | 
| 
      
 41 
     | 
    
         
            +
                        sub_id,
         
     | 
| 
      
 42 
     | 
    
         
            +
                        'resourceGroups',
         
     | 
| 
      
 43 
     | 
    
         
            +
                        resource_group,
         
     | 
| 
      
 44 
     | 
    
         
            +
                        'providers',
         
     | 
| 
      
 45 
     | 
    
         
            +
                        provider,
         
     | 
| 
      
 46 
     | 
    
         
            +
                        resource_type,
         
     | 
| 
      
 47 
     | 
    
         
            +
                        resource_name,
         
     | 
| 
      
 48 
     | 
    
         
            +
                        'metricDefinitions'
         
     | 
| 
      
 49 
     | 
    
         
            +
                      )
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
                      url << "?api-version=#{@api_version}"
         
     | 
| 
      
 52 
     | 
    
         
            +
                      url << "&$filter=#{options[:filter]}" if options[:filter]
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
                      url
         
     | 
| 
      
 55 
     | 
    
         
            +
                    end
         
     | 
| 
      
 56 
     | 
    
         
            +
                  end # MetricsService
         
     | 
| 
      
 57 
     | 
    
         
            +
                end # Insights
         
     | 
| 
      
 58 
     | 
    
         
            +
              end # Armrest
         
     | 
| 
      
 59 
     | 
    
         
            +
            end # Azure
         
     | 
| 
         @@ -167,9 +167,13 @@ module Azure 
     | 
|
| 
       167 
167 
     | 
    
         | 
| 
       168 
168 
     | 
    
         
             
                class AvailabilitySet < BaseModel; end
         
     | 
| 
       169 
169 
     | 
    
         
             
                class Event < BaseModel; end
         
     | 
| 
      
 170 
     | 
    
         
            +
                class ImageVersion < BaseModel; end
         
     | 
| 
      
 171 
     | 
    
         
            +
                class Offer < BaseModel; end
         
     | 
| 
      
 172 
     | 
    
         
            +
                class Publisher < BaseModel; end
         
     | 
| 
       170 
173 
     | 
    
         
             
                class Resource < BaseModel; end
         
     | 
| 
       171 
174 
     | 
    
         
             
                class ResourceGroup < BaseModel; end
         
     | 
| 
       172 
175 
     | 
    
         
             
                class ResourceProvider < BaseModel; end
         
     | 
| 
      
 176 
     | 
    
         
            +
                class Sku < BaseModel; end
         
     | 
| 
       173 
177 
     | 
    
         
             
                class StorageAccount < BaseModel; end
         
     | 
| 
       174 
178 
     | 
    
         
             
                class Subscription < BaseModel; end
         
     | 
| 
       175 
179 
     | 
    
         
             
                class Tag < BaseModel; end
         
     | 
| 
         @@ -188,6 +192,7 @@ module Azure 
     | 
|
| 
       188 
192 
     | 
    
         
             
                module Insights
         
     | 
| 
       189 
193 
     | 
    
         
             
                  class Alert < BaseModel; end
         
     | 
| 
       190 
194 
     | 
    
         
             
                  class Event < BaseModel; end
         
     | 
| 
      
 195 
     | 
    
         
            +
                  class Metric < BaseModel; end
         
     | 
| 
       191 
196 
     | 
    
         
             
                end
         
     | 
| 
       192 
197 
     | 
    
         | 
| 
       193 
198 
     | 
    
         
             
                module Network
         
     | 
| 
         @@ -10,26 +10,23 @@ module Azure 
     | 
|
| 
       10 
10 
     | 
    
         
             
                  # The publisher used in requests when gathering VM image information.
         
     | 
| 
       11 
11 
     | 
    
         
             
                  attr_accessor :publisher
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
                  # Create and return a new VirtualMachineImageService  
     | 
| 
      
 13 
     | 
    
         
            +
                  # Create and return a new VirtualMachineImageService instance.
         
     | 
| 
       14 
14 
     | 
    
         
             
                  #
         
     | 
| 
       15 
15 
     | 
    
         
             
                  # This subclass accepts the additional :location, :provider, and
         
     | 
| 
       16 
     | 
    
         
            -
                  # :publisher options as well. 
     | 
| 
       17 
     | 
    
         
            -
                  # 'Microsoft.Compute'.
         
     | 
| 
      
 16 
     | 
    
         
            +
                  # :publisher options as well.
         
     | 
| 
       18 
17 
     | 
    
         
             
                  #
         
     | 
| 
       19 
18 
     | 
    
         
             
                  def initialize(configuration, options = {})
         
     | 
| 
       20 
     | 
    
         
            -
                    super(configuration,  
     | 
| 
      
 19 
     | 
    
         
            +
                    super(configuration, 'locations/publishers', 'Microsoft.Compute', options)
         
     | 
| 
       21 
20 
     | 
    
         | 
| 
       22 
21 
     | 
    
         
             
                    @location  = options[:location]
         
     | 
| 
       23 
22 
     | 
    
         
             
                    @publisher = options[:publisher]
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
                    set_service_api_version(options, 'locations/publishers')
         
     | 
| 
       26 
23 
     | 
    
         
             
                  end
         
     | 
| 
       27 
24 
     | 
    
         | 
| 
       28 
25 
     | 
    
         
             
                  # Return a list of VM image offers from the given +publisher+ and +location+.
         
     | 
| 
       29 
26 
     | 
    
         
             
                  #
         
     | 
| 
       30 
27 
     | 
    
         
             
                  # Example:
         
     | 
| 
       31 
28 
     | 
    
         
             
                  #
         
     | 
| 
       32 
     | 
    
         
            -
                  #    
     | 
| 
      
 29 
     | 
    
         
            +
                  #   vmis.offers('eastus', 'Canonical')
         
     | 
| 
       33 
30 
     | 
    
         
             
                  #
         
     | 
| 
       34 
31 
     | 
    
         
             
                  def offers(location = @location, publisher = @publisher)
         
     | 
| 
       35 
32 
     | 
    
         
             
                    raise ArgumentError, "No location specified" unless location
         
     | 
| 
         @@ -37,21 +34,21 @@ module Azure 
     | 
|
| 
       37 
34 
     | 
    
         | 
| 
       38 
35 
     | 
    
         
             
                    url = build_url(location, 'publishers', publisher, 'artifacttypes', 'vmimage', 'offers')
         
     | 
| 
       39 
36 
     | 
    
         | 
| 
       40 
     | 
    
         
            -
                    JSON.parse(rest_get(url)).map{ | 
     | 
| 
      
 37 
     | 
    
         
            +
                    JSON.parse(rest_get(url)).map { |hash| Azure::Armrest::Offer.new(hash) }
         
     | 
| 
       41 
38 
     | 
    
         
             
                  end
         
     | 
| 
       42 
39 
     | 
    
         | 
| 
       43 
40 
     | 
    
         
             
                  # Return a list of VM image publishers for the given +location+.
         
     | 
| 
       44 
41 
     | 
    
         
             
                  #
         
     | 
| 
       45 
42 
     | 
    
         
             
                  # Example:
         
     | 
| 
       46 
43 
     | 
    
         
             
                  #
         
     | 
| 
       47 
     | 
    
         
            -
                  #    
     | 
| 
      
 44 
     | 
    
         
            +
                  #   vmis.publishers('eastus')
         
     | 
| 
       48 
45 
     | 
    
         
             
                  #
         
     | 
| 
       49 
46 
     | 
    
         
             
                  def publishers(location = @location)
         
     | 
| 
       50 
47 
     | 
    
         
             
                    raise ArgumentError, "No location specified" unless location
         
     | 
| 
       51 
48 
     | 
    
         | 
| 
       52 
49 
     | 
    
         
             
                    url = build_url(location, 'publishers')
         
     | 
| 
       53 
50 
     | 
    
         | 
| 
       54 
     | 
    
         
            -
                    JSON.parse(rest_get(url)).map{ | 
     | 
| 
      
 51 
     | 
    
         
            +
                    JSON.parse(rest_get(url)).map { |hash| Azure::Armrest::Publisher.new(hash) }
         
     | 
| 
       55 
52 
     | 
    
         
             
                  end
         
     | 
| 
       56 
53 
     | 
    
         | 
| 
       57 
54 
     | 
    
         
             
                  # Return a list of VM image skus for the given +offer+, +location+,
         
     | 
| 
         @@ -59,7 +56,7 @@ module Azure 
     | 
|
| 
       59 
56 
     | 
    
         
             
                  #
         
     | 
| 
       60 
57 
     | 
    
         
             
                  # Example:
         
     | 
| 
       61 
58 
     | 
    
         
             
                  #
         
     | 
| 
       62 
     | 
    
         
            -
                  #    
     | 
| 
      
 59 
     | 
    
         
            +
                  #   vmis.skus('UbuntuServer', 'eastus', 'Canonical')
         
     | 
| 
       63 
60 
     | 
    
         
             
                  #
         
     | 
| 
       64 
61 
     | 
    
         
             
                  def skus(offer, location = @location, publisher = @publisher)
         
     | 
| 
       65 
62 
     | 
    
         
             
                    raise ArgumentError, "No location specified" unless location
         
     | 
| 
         @@ -70,7 +67,7 @@ module Azure 
     | 
|
| 
       70 
67 
     | 
    
         
             
                      'vmimage', 'offers', offer, 'skus'
         
     | 
| 
       71 
68 
     | 
    
         
             
                    )
         
     | 
| 
       72 
69 
     | 
    
         | 
| 
       73 
     | 
    
         
            -
                    JSON.parse(rest_get(url)).map{ | 
     | 
| 
      
 70 
     | 
    
         
            +
                    JSON.parse(rest_get(url)).map { |hash| Azure::Armrest::Sku.new(hash) }
         
     | 
| 
       74 
71 
     | 
    
         
             
                  end
         
     | 
| 
       75 
72 
     | 
    
         | 
| 
       76 
73 
     | 
    
         
             
                  # Return a list of VM image versions for the given +sku+, +offer+,
         
     | 
| 
         @@ -78,21 +75,21 @@ module Azure 
     | 
|
| 
       78 
75 
     | 
    
         
             
                  #
         
     | 
| 
       79 
76 
     | 
    
         
             
                  # Example:
         
     | 
| 
       80 
77 
     | 
    
         
             
                  #
         
     | 
| 
       81 
     | 
    
         
            -
                  #    
     | 
| 
      
 78 
     | 
    
         
            +
                  #   vmis.versions('15.10', 'UbuntuServer', 'eastus', 'Canonical').map(&:name)
         
     | 
| 
       82 
79 
     | 
    
         
             
                  #
         
     | 
| 
       83 
80 
     | 
    
         
             
                  #   # sample output
         
     | 
| 
       84 
     | 
    
         
            -
                  #   => [" 
     | 
| 
      
 81 
     | 
    
         
            +
                  #   => ["15.10.201511111", "15.10.201511161", "15.10.201512030"]
         
     | 
| 
       85 
82 
     | 
    
         
             
                  #
         
     | 
| 
       86 
83 
     | 
    
         
             
                  def versions(sku, offer, location = @location, publisher = @publisher)
         
     | 
| 
       87 
84 
     | 
    
         
             
                    raise ArgumentError, "No location specified" unless location
         
     | 
| 
       88 
85 
     | 
    
         
             
                    raise ArgumentError, "No publisher specified" unless publisher
         
     | 
| 
       89 
86 
     | 
    
         | 
| 
       90 
87 
     | 
    
         
             
                    url = build_url(
         
     | 
| 
       91 
     | 
    
         
            -
                      location, 'publishers', publisher, 'artifacttypes', 
     | 
| 
       92 
     | 
    
         
            -
                      'offers', offer, 'skus', sku, 'versions'
         
     | 
| 
      
 88 
     | 
    
         
            +
                      location, 'publishers', publisher, 'artifacttypes',
         
     | 
| 
      
 89 
     | 
    
         
            +
                      'vmimage', 'offers', offer, 'skus', sku, 'versions'
         
     | 
| 
       93 
90 
     | 
    
         
             
                    )
         
     | 
| 
       94 
91 
     | 
    
         | 
| 
       95 
     | 
    
         
            -
                    JSON.parse(rest_get(url)).map{ | 
     | 
| 
      
 92 
     | 
    
         
            +
                    JSON.parse(rest_get(url)).map { |hash| Azure::Armrest::ImageVersion.new(hash) }
         
     | 
| 
       96 
93 
     | 
    
         
             
                  end
         
     | 
| 
       97 
94 
     | 
    
         | 
| 
       98 
95 
     | 
    
         
             
                  private
         
     | 
| 
         @@ -113,7 +110,6 @@ module Azure 
     | 
|
| 
       113 
110 
     | 
    
         
             
                    url = File.join(url, *args) unless args.empty?
         
     | 
| 
       114 
111 
     | 
    
         
             
                    url << "?api-version=#{@api_version}"
         
     | 
| 
       115 
112 
     | 
    
         
             
                  end
         
     | 
| 
       116 
     | 
    
         
            -
             
     | 
| 
       117 
113 
     | 
    
         
             
                end # VirtualMachineImageService
         
     | 
| 
       118 
114 
     | 
    
         
             
              end # Armrest
         
     | 
| 
       119 
115 
     | 
    
         
             
            end # Azure
         
     | 
    
        data/lib/azure/armrest.rb
    CHANGED
    
    | 
         @@ -22,6 +22,7 @@ end 
     | 
|
| 
       22 
22 
     | 
    
         | 
| 
       23 
23 
     | 
    
         
             
            require 'azure/armrest/version'
         
     | 
| 
       24 
24 
     | 
    
         
             
            require 'azure/armrest/exception'
         
     | 
| 
      
 25 
     | 
    
         
            +
            require 'azure/armrest/armrest_collection'
         
     | 
| 
       25 
26 
     | 
    
         
             
            require 'azure/armrest/armrest_service'
         
     | 
| 
       26 
27 
     | 
    
         
             
            require 'azure/armrest/resource_group_based_service'
         
     | 
| 
       27 
28 
     | 
    
         
             
            require 'azure/armrest/resource_group_based_subservice'
         
     | 
| 
         @@ -36,6 +37,7 @@ require 'azure/armrest/resource_group_service' 
     | 
|
| 
       36 
37 
     | 
    
         
             
            require 'azure/armrest/resource_provider_service'
         
     | 
| 
       37 
38 
     | 
    
         
             
            require 'azure/armrest/insights/alert_service'
         
     | 
| 
       38 
39 
     | 
    
         
             
            require 'azure/armrest/insights/event_service'
         
     | 
| 
      
 40 
     | 
    
         
            +
            require 'azure/armrest/insights/metrics_service'
         
     | 
| 
       39 
41 
     | 
    
         
             
            require 'azure/armrest/network/ip_address_service'
         
     | 
| 
       40 
42 
     | 
    
         
             
            require 'azure/armrest/network/network_interface_service'
         
     | 
| 
       41 
43 
     | 
    
         
             
            require 'azure/armrest/network/network_security_group_service'
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: azure-armrest
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.2. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.2.3
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Daniel J. Berger
         
     | 
| 
         @@ -11,7 +11,7 @@ authors: 
     | 
|
| 
       11 
11 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       12 
12 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       13 
13 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       14 
     | 
    
         
            -
            date: 2016-03- 
     | 
| 
      
 14 
     | 
    
         
            +
            date: 2016-03-29 00:00:00.000000000 Z
         
     | 
| 
       15 
15 
     | 
    
         
             
            dependencies:
         
     | 
| 
       16 
16 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       17 
17 
     | 
    
         
             
              name: json
         
     | 
| 
         @@ -191,11 +191,13 @@ files: 
     | 
|
| 
       191 
191 
     | 
    
         
             
            - azure-armrest.gemspec
         
     | 
| 
       192 
192 
     | 
    
         
             
            - lib/azure-armrest.rb
         
     | 
| 
       193 
193 
     | 
    
         
             
            - lib/azure/armrest.rb
         
     | 
| 
      
 194 
     | 
    
         
            +
            - lib/azure/armrest/armrest_collection.rb
         
     | 
| 
       194 
195 
     | 
    
         
             
            - lib/azure/armrest/armrest_service.rb
         
     | 
| 
       195 
196 
     | 
    
         
             
            - lib/azure/armrest/availability_set_service.rb
         
     | 
| 
       196 
197 
     | 
    
         
             
            - lib/azure/armrest/exception.rb
         
     | 
| 
       197 
198 
     | 
    
         
             
            - lib/azure/armrest/insights/alert_service.rb
         
     | 
| 
       198 
199 
     | 
    
         
             
            - lib/azure/armrest/insights/event_service.rb
         
     | 
| 
      
 200 
     | 
    
         
            +
            - lib/azure/armrest/insights/metrics_service.rb
         
     | 
| 
       199 
201 
     | 
    
         
             
            - lib/azure/armrest/model/base_model.rb
         
     | 
| 
       200 
202 
     | 
    
         
             
            - lib/azure/armrest/model/storage_account.rb
         
     | 
| 
       201 
203 
     | 
    
         
             
            - lib/azure/armrest/network/ip_address_service.rb
         
     |