lib/fog/azurerm/docs/storage.md in gitlab-fog-azure-rm-0.6.0 vs lib/fog/azurerm/docs/storage.md in gitlab-fog-azure-rm-0.7.0

- old
+ new

@@ -10,164 +10,17 @@ require 'fog/azurerm' ``` ## Create Connection -Next, create a connection to the Storage Service: - -```ruby -fog_storage_service = Fog::Storage::AzureRM.new( - tenant_id: '<Tenant Id>', # Tenant Id of Azure Active Directory Application - client_id: '<Client Id>', # Client Id of Azure Active Directory Application - client_secret: '<Client Secret>', # Client Secret of Azure Active Directory Application - subscription_id: '<Subscription Id>', # Subscription Id of an Azure Account - azure_storage_account_name: '<Storage Account Name>', # Name of an Azure Storage Account - azure_storage_access_key: '<Storage Account Key>', # Key of an Azure Storage Account - environment: '<AzureCloud/AzureChinaCloud/AzureUSGovernment/AzureGermanCloud>' # Azure cloud environment. Default is AzureCloud. -) -``` - -If you only want to manage the storage accounts, you can create the connection without the storage account information: - -```ruby -fog_storage_service = Fog::Storage::AzureRM.new( - tenant_id: '<Tenant Id>', # Tenant Id of Azure Active Directory Application - client_id: '<Client Id>', # Client Id of Azure Active Directory Application - client_secret: '<Client Secret>', # Client Secret of Azure Active Directory Application - subscription_id: '<Subscription Id>', # Subscription Id of an Azure Account - environment: '<AzureCloud/AzureChinaCloud/AzureUSGovernment/AzureGermanCloud>' # Azure cloud environment. Default is AzureCloud. -) -``` - If you only want to manage the storage data, you can create the connection without the Azure subscription information: ```ruby fog_storage_service = Fog::Storage::AzureRM.new( azure_storage_account_name: '<Storage Account Name>', # Name of an Azure Storage Account azure_storage_access_key: '<Storage Account Key>', # Key of an Azure Storage Account environment: '<AzureCloud/AzureChinaCloud/AzureUSGovernment/AzureGermanCloud>' # Azure cloud environment. Default is AzureCloud. ) -``` - -## Check Name Availability - -This operation checks that account name is valid and is not already in use. _Storage Account Type_ is an optional parameter - -```ruby -fog_storage_service.storage_accounts.check_name_availability('<Storage Account Name>', '<Storage Account Type>') -``` - -## Check Storage Account Existence - -```ruby -fog_storage_service.storage_accounts.check_storage_account_exists('<Resource Group Name>', '<Storage Account Name>') -``` - -## Create Storage Account - -Create a new storage account. Replication attribute for Standard and Premium account types are as follows - -##### Standard - -1. LRS (Standard Locally-redundant storage) -2. ZRS (Standard Zone-redundant storage) -3. GRS (Standard Geo-redundant storage) -4. RAGRS (Standard Read access geo-redundant storage) - -##### Premium -1. LRS (Premium Locally-redundant storage) - -```ruby -fog_storage_service.storage_accounts.create( - name: '<Storage Account name>', - location: '<Location>', - resource_group: '<Resource Group Name>', - account_type: '<Standard/Premium>', # [Optional] Default value 'Standard'. Allowed values can only be Standard or Premium - replication: '<Replication Type>', # [Optional] Default value 'LRS' - encryption: <True/False>, # [Optional] Enables encryption. Default is false. - tags: { key1: 'value1', key2: 'value2', keyN: 'valueN' } # [Optional] -) -``` -Premium Storage account store data on solid state drives (SSDs). For more details on standard and premium storage accounts, see [Introduction to Microsoft Azure Storage](https://azure.microsoft.com/en-us/documentation/articles/storage-introduction/) and [Premium Storage: High-Performance Storage for Azure Virtual Machine Workloads](https://azure.microsoft.com/en-us/documentation/articles/storage-premium-storage/). - -## List storage accounts - -##### List storage accounts in a subscription - -```ruby -fog_storage_service.storage_accounts.each do |storage_acc| - puts "#{storage_acc.name}" - puts "#{storage_acc.location}" -end -``` -##### List storage accounts in a resource group - -```ruby -storage_accounts = fog_storage_service.storage_accounts(resource_group: '<Resource Group Name>') -storage_accounts.each do |storage_acc| - puts "#{storage_acc.name}" - puts "#{storage_acc.location}" -end -``` - -## Retrieve a single Storage Account - -Get a single record of Storage Account - -```ruby -storage_acc = fog_storage_service - .storage_accounts - .get('<Resource Group Name>', '<Storage Account Name>') -puts "#{storage_acc.name}" -``` - -## Enable encryption on Storage Account - -Get a single record of Storage Account and enable encryption on that Storage Account - -```ruby -storage_acc = fog_storage_service - .storage_accounts - .get('<Resource Group Name>', '<Storage Account Name>') - -storage_acc.update(encryption: true) -``` - -## Get Access Keys - -Get access keys of a storage account - -```ruby -keys_hash = storage_acc.get_access_keys -keys_hash.each do |keys| - puts "#{keys.key_name}: #{keys.value}" -end -``` - -## Destroy a single Storage Account - -Get storage account object from the get method and then destroy that storage account. - -```ruby -storage_acc.destroy -``` - -## Create a Disk - -Create a Disk in storage account. _disk_size_in_gb_ must be an integer and the range is [1, 1023]. -By default the disk will be created in the container 'vhds'. You can specify other container by set options[:container_name]. - -```ruby -fog_storage_service.create_disk('<Data Disk Name>', disk_size_in_gb, options = {}) -``` - -## Delete a Disk - -Delete a Disk from a storage account. Disk must be in unlocked state i.e detached from server (virtual machine) to successfully perform this action. -By default the disk will be deleted from the container 'vhds'. You can specify other container by set options[:container_name]. - -```ruby -fog_storage_service.delete_disk('<Data Disk Name>', options = {}) ``` ## Check Storage Container Existence ```ruby