Sha256: abeb9d501de9fcf82d2b726a7c46eb2b0c10728d27f0eb5ae87d77a5ac07fca9

Contents?: true

Size: 1.15 KB

Versions: 43

Compression:

Stored size: 1.15 KB

Contents

module Azure
  module Armrest
    class SubscriptionService < ArmrestService
      # This overrides the typical constructor for an ArmrestService subclass
      # because it does not have a service name or a provider.
      def initialize(configuration, options = {})
        @armrest_configuration = configuration
        @api_version = options[:api_version] || '2016-06-01'
      end

      # Returns a list of Subscription objects for the current tenant, one for
      # each subscription ID.
      #
      def list
        url = subscriptions_url + "?api-version=#{api_version}"
        response = rest_get(url)
        Azure::Armrest::ArmrestCollection.create_from_response(response, Azure::Armrest::Subscription)
      end

      # Returns a Subscription object for the given +subscription_id+.
      #
      def get(subscription_id)
        url = File.join(subscriptions_url, subscription_id) + "?api-version=#{api_version}"
        response = rest_get(url)
        Azure::Armrest::Subscription.new(response)
      end

      private

      def subscriptions_url
        File.join(configuration.environment.resource_url, 'subscriptions')
      end
    end
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
azure-armrest-0.15.0 lib/azure/armrest/subscription_service.rb
azure-armrest-0.14.0 lib/azure/armrest/subscription_service.rb
azure-armrest-0.13.1 lib/azure/armrest/subscription_service.rb
azure-armrest-0.13.0 lib/azure/armrest/subscription_service.rb
azure-armrest-0.12.0 lib/azure/armrest/subscription_service.rb
azure-armrest-0.11.0 lib/azure/armrest/subscription_service.rb
azure-armrest-0.9.16 lib/azure/armrest/subscription_service.rb
azure-armrest-0.10.0 lib/azure/armrest/subscription_service.rb
azure-armrest-0.9.15 lib/azure/armrest/subscription_service.rb
azure-armrest-0.9.14 lib/azure/armrest/subscription_service.rb
azure-armrest-0.9.13 lib/azure/armrest/subscription_service.rb
azure-armrest-0.9.12 lib/azure/armrest/subscription_service.rb
azure-armrest-0.9.11 lib/azure/armrest/subscription_service.rb
azure-armrest-0.9.10 lib/azure/armrest/subscription_service.rb
azure-armrest-0.9.9 lib/azure/armrest/subscription_service.rb
azure-armrest-0.9.8 lib/azure/armrest/subscription_service.rb
azure-armrest-0.9.7 lib/azure/armrest/subscription_service.rb
azure-armrest-0.9.6 lib/azure/armrest/subscription_service.rb
azure-armrest-0.9.5 lib/azure/armrest/subscription_service.rb
azure-armrest-0.9.4 lib/azure/armrest/subscription_service.rb