Sha256: eab67e2d437e8326b628b72efd29774fe77ca0a228d175fae57cf7407d72377a

Contents?: true

Size: 1.38 KB

Versions: 28

Compression:

Stored size: 1.38 KB

Contents

module Fog
  module Resources
    class AzureRM
      # This class provides the actual implementation for service calls.
      class Real
        def create_resource_group(name, location, tags)
          msg = "Creating Resource Group: #{name}."
          Fog::Logger.debug msg
          resource_group = Azure::ARM::Resources::Models::ResourceGroup.new
          resource_group.location = location
          resource_group.tags = tags
          begin
            resource_group = @rmc.resource_groups.create_or_update(name, resource_group)
          rescue  MsRestAzure::AzureOperationError => e
            raise_azure_exception(e, msg)
          end
          Fog::Logger.debug "Resource Group #{name} created successfully."
          resource_group
        end
      end

      # This class provides the mock implementation for unit tests.
      class Mock
        def create_resource_group(name, location)
          resource_group = {
            'location' => location,
            'id' => "/subscriptions/########-####-####-####-############/resourceGroups/#{name}",
            'name' => name,
            'properties' =>
            {
              'provisioningState' => 'Succeeded'
            }
          }
          result_mapper = Azure::ARM::Resources::Models::ResourceGroup.mapper
          @rmc.deserialize(result_mapper, resource_group, 'result.body')
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 3 rubygems

Version Path
fog-azure-rm-0.6.0 lib/fog/azurerm/requests/resources/create_resource_group.rb
fog-azure-rm-0.5.3 lib/fog/azurerm/requests/resources/create_resource_group.rb
fog-azure-rm-0.5.2 lib/fog/azurerm/requests/resources/create_resource_group.rb
far-gem-0.5.6 lib/fog/azurerm/requests/resources/create_resource_group.rb
fog-azure-rm-0.5.1 lib/fog/azurerm/requests/resources/create_resource_group.rb
far-gem-0.5.5 lib/fog/azurerm/requests/resources/create_resource_group.rb
fog-azure-rm-0.5.0 lib/fog/azurerm/requests/resources/create_resource_group.rb
far-gem-0.5.4 lib/fog/azurerm/requests/resources/create_resource_group.rb
far-gem-0.5.3 lib/fog/azurerm/requests/resources/create_resource_group.rb
fog-azure-rm-0.4.9 lib/fog/azurerm/requests/resources/create_resource_group.rb
far-gem-0.5.2 lib/fog/azurerm/requests/resources/create_resource_group.rb
fog-azure-rm-0.4.8 lib/fog/azurerm/requests/resources/create_resource_group.rb
fog-azure-rm-0.4.7 lib/fog/azurerm/requests/resources/create_resource_group.rb
fog-azure-rm-0.4.6 lib/fog/azurerm/requests/resources/create_resource_group.rb
fog-azure-rm-0.4.5 lib/fog/azurerm/requests/resources/create_resource_group.rb
fog-azure-rm-temp-0.0.5 lib/fog/azurerm/requests/resources/create_resource_group.rb
fog-azure-rm-0.4.4 lib/fog/azurerm/requests/resources/create_resource_group.rb
fog-azure-rm-0.4.3 lib/fog/azurerm/requests/resources/create_resource_group.rb
far-gem-0.5.1 lib/fog/azurerm/requests/resources/create_resource_group.rb
fog-azure-rm-0.4.2 lib/fog/azurerm/requests/resources/create_resource_group.rb