Sha256: 64fee6e11d20a9a0e5fa351f709a4f5a36c9e4f2f44d323dbfad09fda1bb1d95

Contents?: true

Size: 1.64 KB

Versions: 1

Compression:

Stored size: 1.64 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(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

1 entries across 1 versions & 1 rubygems

Version Path
fog-azure-rm-0.1.0 lib/fog/azurerm/models/storage/recovery_vault.rb