Sha256: f100fa4b3e85efa70c82cbecc96318def363bf2b8bd0bd0dd1d9883c6d12b244

Contents?: true

Size: 1.61 KB

Versions: 18

Compression:

Stored size: 1.61 KB

Contents

module Fog
  module Storage
    class AzureRM
      # This class is giving implementation of create/save and
      # delete/destroy for Recovery Vault.
      class RecoveryVault < Fog::Model
        attribute :id
        identity :name
        attribute :resource_group
        attribute :location
        attribute :type
        attribute :sku_name

        def self.parse(recovery_vault)
          {
            id: recovery_vault['id'],
            name: recovery_vault['name'],
            resource_group: get_resource_group_from_id(recovery_vault['id']),
            location: recovery_vault['location'],
            type: recovery_vault['type'],
            sku_name: recovery_vault['sku']['name']
          }
        end

        def save
          requires :name, :location, :resource_group
          recovery_vault = service.create_or_update_recovery_vault(resource_group, location, name)
          merge_attributes(Fog::Storage::AzureRM::RecoveryVault.parse(recovery_vault))
        end

        def enable_backup_protection(vm_name, vm_resource_group)
          requires :name, :resource_group
          service.enable_backup_protection(name, resource_group, vm_name, vm_resource_group)
        end

        def start_backup(vm_name, vm_resource_group)
          service.start_backup(resource_group, name, vm_name, vm_resource_group)
        end

        def disable_backup_protection(vm_name, vm_resource_group)
          service.disable_backup_protection(name, resource_group, vm_name, vm_resource_group)
        end

        def destroy
          service.delete_recovery_vault(resource_group, name)
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 3 rubygems

Version Path
fog-azure-rm-temp-0.0.4 lib/fog/azurerm/models/storage/recovery_vault.rb
fog-azure-rm-0.3.3 lib/fog/azurerm/models/storage/recovery_vault.rb
fog-azure-rm-temp-0.0.2 lib/fog/azurerm/models/storage/recovery_vault.rb
fog-azure-rm-temp-0.0.1 lib/fog/azurerm/models/storage/recovery_vault.rb
fog-azure-rm-0.3.2 lib/fog/azurerm/models/storage/recovery_vault.rb
fog-azure-rm-downgraded-0.3.1 lib/fog/azurerm/models/storage/recovery_vault.rb
fog-azure-rm-0.3.1 lib/fog/azurerm/models/storage/recovery_vault.rb
fog-azure-rm-downgraded-0.3.0 lib/fog/azurerm/models/storage/recovery_vault.rb
fog-azure-rm-0.3.0 lib/fog/azurerm/models/storage/recovery_vault.rb
fog-azure-rm-0.2.7 lib/fog/azurerm/models/storage/recovery_vault.rb
fog-azure-rm-0.2.6 lib/fog/azurerm/models/storage/recovery_vault.rb
fog-azure-rm-0.2.5 lib/fog/azurerm/models/storage/recovery_vault.rb
fog-azure-rm-0.2.4 lib/fog/azurerm/models/storage/recovery_vault.rb
fog-azure-rm-0.2.3 lib/fog/azurerm/models/storage/recovery_vault.rb
fog-azure-rm-0.2.2 lib/fog/azurerm/models/storage/recovery_vault.rb
fog-azure-rm-0.2.1 lib/fog/azurerm/models/storage/recovery_vault.rb
fog-azure-rm-0.2.0 lib/fog/azurerm/models/storage/recovery_vault.rb
fog-azure-rm-0.1.2 lib/fog/azurerm/models/storage/recovery_vault.rb