Class: Azure::Armrest::ResourceGroupBasedSubservice
- Inherits:
-
ResourceGroupBasedService
- Object
- ArmrestService
- ResourceGroupBasedService
- Azure::Armrest::ResourceGroupBasedSubservice
- Defined in:
- lib/azure/armrest/resource_group_based_subservice.rb
Overview
Base class for services that have two levels in the path and need to run in a resource group
Direct Known Subclasses
HDInsight::ApplicationService, Network::InboundNatService, Network::NetworkSecurityRuleService, Network::RouteService, Network::SubnetService, Sql::SqlDatabaseService
Constant Summary
Constants inherited from ResourceGroupBasedService
Azure::Armrest::ResourceGroupBasedService::SERVICE_NAME_MAP
Instance Attribute Summary
Attributes inherited from ArmrestService
#api_version, #armrest_configuration, #base_url, #provider, #service_name
Instance Method Summary collapse
- #create(resource, subresource, rgroup = configuration.resource_group, options = {}) ⇒ Object (also: #update)
- #delete(resource, subresource, rgroup = configuration.resource_group) ⇒ Object
- #get(resource, subresource, rgroup = configuration.resource_group) ⇒ Object
-
#initialize(configuration, service_name, subservice_name, default_provider, options) ⇒ ResourceGroupBasedSubservice
constructor
Do not instantiate directly.
- #list(resource, rgroup = configuration.resource_group) ⇒ Object (also: #list_all)
Methods inherited from ResourceGroupBasedService
Methods inherited from ArmrestService
configure, #get_provider, #get_subscription, #list_locations, #list_resource_groups, #list_resources, #list_subscriptions, #locations, #poll, #tags, #tenants, #wait
Constructor Details
#initialize(configuration, service_name, subservice_name, default_provider, options) ⇒ ResourceGroupBasedSubservice
Do not instantiate directly. This is an abstract base class from which all other service classes should subclass, and call super within their own constructors.
9 10 11 12 |
# File 'lib/azure/armrest/resource_group_based_subservice.rb', line 9 def initialize(configuration, service_name, subservice_name, default_provider, ) @subservice_name = subservice_name super(configuration, service_name, default_provider, ) end |
Instance Method Details
#create(resource, subresource, rgroup = configuration.resource_group, options = {}) ⇒ Object Also known as: update
14 15 16 17 18 19 |
# File 'lib/azure/armrest/resource_group_based_subservice.rb', line 14 def create(resource, subresource, rgroup = configuration.resource_group, = {}) validate_resource_group(rgroup) validate_resource(resource) validate_subresource(subresource) super(combine(resource, subresource), rgroup, ) end |
#delete(resource, subresource, rgroup = configuration.resource_group) ⇒ Object
42 43 44 45 46 47 |
# File 'lib/azure/armrest/resource_group_based_subservice.rb', line 42 def delete(resource, subresource, rgroup = configuration.resource_group) validate_resource_group(rgroup) validate_resource(resource) validate_subresource(subresource) super(combine(resource, subresource), rgroup) end |
#get(resource, subresource, rgroup = configuration.resource_group) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/azure/armrest/resource_group_based_subservice.rb', line 35 def get(resource, subresource, rgroup = configuration.resource_group) validate_resource_group(rgroup) validate_resource(resource) validate_subresource(subresource) super(combine(resource, subresource), rgroup) end |
#list(resource, rgroup = configuration.resource_group) ⇒ Object Also known as: list_all
23 24 25 26 27 28 29 30 31 |
# File 'lib/azure/armrest/resource_group_based_subservice.rb', line 23 def list(resource, rgroup = configuration.resource_group) validate_resource_group(rgroup) validate_resource(resource) url = build_url(rgroup, resource, @subservice_name) url = yield(url) || url if block_given? response = rest_get(url) JSON.parse(response)['value'].map { |hash| model_class.new(hash) } end |