Class: Fog::Storage::AzureRM::Mock
- Inherits:
-
Object
- Object
- Fog::Storage::AzureRM::Mock
- Defined in:
- lib/fog/azurerm/storage.rb,
lib/fog/azurerm/requests/storage/get_blob.rb,
lib/fog/azurerm/requests/storage/copy_blob.rb,
lib/fog/azurerm/requests/storage/list_blobs.rb,
lib/fog/azurerm/requests/storage/create_disk.rb,
lib/fog/azurerm/requests/storage/delete_blob.rb,
lib/fog/azurerm/requests/storage/delete_disk.rb,
lib/fog/azurerm/requests/storage/get_blob_url.rb,
lib/fog/azurerm/requests/storage/put_blob_block.rb,
lib/fog/azurerm/requests/storage/put_blob_pages.rb,
lib/fog/azurerm/requests/storage/save_page_blob.rb,
lib/fog/azurerm/requests/storage/list_containers.rb,
lib/fog/azurerm/requests/storage/create_container.rb,
lib/fog/azurerm/requests/storage/create_page_blob.rb,
lib/fog/azurerm/requests/storage/delete_container.rb,
lib/fog/azurerm/requests/storage/create_block_blob.rb,
lib/fog/azurerm/requests/storage/get_blob_http_url.rb,
lib/fog/azurerm/requests/storage/get_container_acl.rb,
lib/fog/azurerm/requests/storage/get_container_url.rb,
lib/fog/azurerm/requests/storage/put_blob_metadata.rb,
lib/fog/azurerm/requests/storage/put_container_acl.rb,
lib/fog/azurerm/requests/storage/acquire_blob_lease.rb,
lib/fog/azurerm/requests/storage/commit_blob_blocks.rb,
lib/fog/azurerm/requests/storage/copy_blob_from_uri.rb,
lib/fog/azurerm/requests/storage/get_blob_https_url.rb,
lib/fog/azurerm/requests/storage/release_blob_lease.rb,
lib/fog/azurerm/requests/storage/get_blob_properties.rb,
lib/fog/azurerm/requests/storage/get_storage_account.rb,
lib/fog/azurerm/requests/storage/put_blob_properties.rb,
lib/fog/azurerm/requests/storage/list_storage_accounts.rb,
lib/fog/azurerm/requests/storage/check_container_exists.rb,
lib/fog/azurerm/requests/storage/create_storage_account.rb,
lib/fog/azurerm/requests/storage/delete_storage_account.rb,
lib/fog/azurerm/requests/storage/put_container_metadata.rb,
lib/fog/azurerm/requests/storage/update_storage_account.rb,
lib/fog/azurerm/requests/storage/acquire_container_lease.rb,
lib/fog/azurerm/requests/storage/compare_container_blobs.rb,
lib/fog/azurerm/requests/storage/get_storage_access_keys.rb,
lib/fog/azurerm/requests/storage/release_container_lease.rb,
lib/fog/azurerm/requests/storage/get_container_properties.rb,
lib/fog/azurerm/requests/storage/multipart_save_block_blob.rb,
lib/fog/azurerm/requests/storage/list_storage_account_for_rg.rb,
lib/fog/azurerm/requests/storage/check_storage_account_exists.rb,
lib/fog/azurerm/requests/storage/wait_blob_copy_operation_to_finish.rb,
lib/fog/azurerm/requests/storage/check_storage_account_name_availability.rb
Overview
This class provides the mock implementation for unit tests.
Instance Method Summary collapse
- #acquire_blob_lease ⇒ Object
- #acquire_container_lease ⇒ Object
- #check_container_exists ⇒ Object
- #check_storage_account_exists ⇒ Object
- #check_storage_account_name_availability(params) ⇒ Object
- #commit_blob_blocks ⇒ Object
- #compare_container_blobs ⇒ Object
- #copy_blob ⇒ Object
- #copy_blob_from_uri ⇒ Object
- #create_block_blob(_container_name, _blob_name, body, _options = {}) ⇒ Object
- #create_container ⇒ Object
- #create_disk ⇒ Object
- #create_page_blob ⇒ Object
- #create_storage_account ⇒ Object
- #delete_blob ⇒ Object
- #delete_container ⇒ Object
- #delete_disk ⇒ Object
- #delete_storage_account(resource_group, name) ⇒ Object
- #get_blob(_container_name, _blob_name, _options = {}, &_block) ⇒ Object
- #get_blob_http_url ⇒ Object
- #get_blob_https_url ⇒ Object
- #get_blob_properties ⇒ Object
- #get_blob_url(_container_name, _blob_name, options = {}) ⇒ Object
- #get_container_acl ⇒ Object
- #get_container_properties ⇒ Object
- #get_container_url(_container_name, options = {}) ⇒ Object
- #get_storage_access_keys(_resource_group, storage_account_name, _options = {}) ⇒ Object
- #get_storage_account ⇒ Object
-
#initialize(_options = {}) ⇒ Mock
constructor
A new instance of Mock.
- #list_blobs ⇒ Object
- #list_containers ⇒ Object
- #list_storage_account_for_rg(resource_group) ⇒ Object
- #list_storage_accounts ⇒ Object
- #multipart_save_block_blob ⇒ Object
- #put_blob_block ⇒ Object
- #put_blob_metadata(container_name, name, metadata, _options = {}) ⇒ Object
- #put_blob_pages ⇒ Object
- #put_blob_properties(container_name, name, options = {}) ⇒ Object
- #put_container_acl ⇒ Object
- #put_container_metadata ⇒ Object
- #release_blob_lease ⇒ Object
- #release_container_lease ⇒ Object
- #save_page_blob ⇒ Object
- #update_storage_account ⇒ Object
- #wait_blob_copy_operation_to_finish ⇒ Object
Constructor Details
#initialize(_options = {}) ⇒ Mock
Returns a new instance of Mock.
77 78 79 80 81 82 83 84 85 |
# File 'lib/fog/azurerm/storage.rb', line 77 def initialize( = {}) begin require 'azure_mgmt_storage' require 'azure/storage' rescue LoadError => e retry if require('rubygems') raise e. end end |
Instance Method Details
#acquire_blob_lease ⇒ Object
24 25 26 27 28 |
# File 'lib/fog/azurerm/requests/storage/acquire_blob_lease.rb', line 24 def acquire_blob_lease(*) { 'leaseId' => 'abc123' } end |
#acquire_container_lease ⇒ Object
24 25 26 27 28 |
# File 'lib/fog/azurerm/requests/storage/acquire_container_lease.rb', line 24 def acquire_container_lease(*) { 'leaseId' => 'abc123' } end |
#check_container_exists ⇒ Object
24 25 26 |
# File 'lib/fog/azurerm/requests/storage/check_container_exists.rb', line 24 def check_container_exists(*) true end |
#check_storage_account_exists ⇒ Object
31 32 33 |
# File 'lib/fog/azurerm/requests/storage/check_storage_account_exists.rb', line 31 def check_storage_account_exists(*) true end |
#check_storage_account_name_availability(params) ⇒ Object
37 38 39 40 |
# File 'lib/fog/azurerm/requests/storage/check_storage_account_name_availability.rb', line 37 def check_storage_account_name_availability(params) Fog::Logger.debug "Name: #{params.name} is available." true end |
#commit_blob_blocks ⇒ Object
24 25 26 |
# File 'lib/fog/azurerm/requests/storage/commit_blob_blocks.rb', line 24 def commit_blob_blocks(*) true end |
#compare_container_blobs ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/fog/azurerm/requests/storage/compare_container_blobs.rb', line 37 def compare_container_blobs(*) [ { 'name' => 'test_blob1', 'metadata' => {}, 'properties' => { 'last_modified' => 'Mon, 04 Jul 2016 02:50:20 GMT', 'etag' => '0x8D3A3B5F017F52D', 'lease_status' => 'unlocked', 'lease_state' => 'available', 'content_length' => 4_194_304, 'content_type' => 'application/octet-stream', 'content_encoding' => nil, 'content_language' => nil, 'content_disposition' => nil, 'content_md5' => 'tXAohIyxuu/t94Lp/ujeRw==', 'cache_control' => nil, 'sequence_number' => 0, 'blob_type' => 'PageBlob', 'copy_id' => '095adc3b-e277-4c3d-97e0-0abca881f60c', 'copy_status' => 'success', 'copy_source' => 'https://testaccount.blob.core.windows.net/test_container/test_blob?snapshot=2016-02-04T08%3A35%3A50.3256874Z', 'copy_progress' => '4194304/4194304', 'copy_completion_time' => 'Thu, 04 Feb 2016 08:35:52 GMT', 'copy_status_description' => nil, 'accept_ranges' => 0 } }, { 'name' => 'test_blob2', 'metadata' => {}, 'properties' => { 'last_modified' => 'Tue, 04 Aug 2015 06:02:08 GMT', 'etag' => '0x8D29C92173526C8', 'lease_status' => 'unlocked', 'lease_state' => 'available', 'content_length' => 4_194_304, 'content_type' => 'application/octet-stream', 'content_encoding' => nil, 'content_language' => nil, 'content_disposition' => nil, 'content_md5' => 'tXAohIyxuu/t94Lp/ujeRw==', 'cache_control' => nil, 'sequence_number' => 0, 'blob_type' => 'PageBlob', 'copy_id' => '0abcdc3b-4c3d-e277-97e0-0abca881f60c', 'copy_status' => 'success', 'copy_source' => 'https://testaccount.blob.core.windows.net/test_container/test_blob?snapshot=2016-02-04T08%3A35%3A55.3157696Z', 'copy_progress' => '4194304/4194304', 'copy_completion_time' => 'Thu, 04 Feb 2016 08:40:52 GMT', 'copy_status_description' => nil, 'accept_ranges' => 0 } }, { 'name' => 'test_blob3', 'metadata' => {}, 'properties' => { 'last_modified' => 'Tue, 04 Aug 2015 06:02:08 GMT', 'etag' => '0x8D29C92173526C8', 'lease_status' => 'unlocked', 'lease_state' => 'available', 'content_length' => 4_194_304, 'content_type' => 'application/octet-stream', 'content_encoding' => nil, 'content_language' => nil, 'content_disposition' => nil, 'content_md5' => 'tXAohIyxuu/t94Lp/ujeRw==', 'cache_control' => nil, 'sequence_number' => 0, 'blob_type' => 'PageBlob', 'copy_id' => '0abcdc3b-4c3d-e277-97e0-0abca881f60c', 'copy_status' => 'success', 'copy_source' => 'https://testaccount.blob.core.windows.net/test_container/test_blob?snapshot=2016-02-04T08%3A35%3A55.3157696Z', 'copy_progress' => '4194304/4194304', 'copy_completion_time' => 'Thu, 04 Feb 2016 08:40:52 GMT', 'copy_status_description' => nil, 'accept_ranges' => 0 } }, { 'name' => 'test_blob4', 'metadata' => {}, 'properties' => { 'last_modified' => 'Tue, 04 Aug 2015 06:02:08 GMT', 'etag' => '0x8D29C92173526C8', 'lease_status' => 'unlocked', 'lease_state' => 'available', 'content_length' => 4_194_304, 'content_type' => 'application/octet-stream', 'content_encoding' => nil, 'content_language' => nil, 'content_disposition' => nil, 'content_md5' => 'tXAohIyxuu/t94Lp/ujeRw==', 'cache_control' => nil, 'sequence_number' => 0, 'blob_type' => 'PageBlob', 'copy_id' => '0abcdc3b-4c3d-e277-97e0-0abca881f60c', 'copy_status' => 'success', 'copy_source' => 'https://testaccount.blob.core.windows.net/test_container/test_blob?snapshot=2016-02-04T08%3A35%3A55.3157696Z', 'copy_progress' => '4194304/4194304', 'copy_completion_time' => 'Thu, 04 Feb 2016 08:40:52 GMT', 'copy_status_description' => nil, 'accept_ranges' => 0 } } ] end |
#copy_blob ⇒ Object
24 25 26 |
# File 'lib/fog/azurerm/requests/storage/copy_blob.rb', line 24 def copy_blob(*) %w(abc123 pending) end |
#copy_blob_from_uri ⇒ Object
24 25 26 |
# File 'lib/fog/azurerm/requests/storage/copy_blob_from_uri.rb', line 24 def copy_blob_from_uri(*) %w(abc123 pending) end |
#create_block_blob(_container_name, _blob_name, body, _options = {}) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/fog/azurerm/requests/storage/create_block_blob.rb', line 47 def create_block_blob(_container_name, _blob_name, body, = {}) Fog::Logger.debug 'Blob created successfully.' if body.nil? { 'name' => 'test_blob', 'metadata' => {}, 'properties' => { 'last_modified' => 'Mon, 04 Jul 2016 02:50:20 GMT', 'etag' => '0x8D3A3B5F017F52D', 'lease_status' => nil, 'lease_state' => nil, 'content_length' => 0, 'content_type' => 'application/octet-stream', 'content_encoding' => nil, 'content_language' => nil, 'content_disposition' => nil, 'content_md5' => nil, 'cache_control' => nil, 'sequence_number' => 0, 'blob_type' => 'BlockBlob', 'copy_id' => nil, 'copy_status' => nil, 'copy_source' => nil, 'copy_progress' => nil, 'copy_completion_time' => nil, 'copy_status_description' => nil, 'accept_ranges' => 0 } } else { 'name' => 'test_blob', 'metadata' => {}, 'properties' => { 'last_modified' => 'Mon, 04 Jul 2016 02:50:20 GMT', 'etag' => '0x8D3A3B5F017F52D', 'lease_status' => 'unlocked', 'lease_state' => 'available', 'content_length' => 4_194_304, 'content_type' => 'application/octet-stream', 'content_encoding' => nil, 'content_language' => nil, 'content_disposition' => nil, 'content_md5' => 'tXAohIyxuu/t94Lp/ujeRw==', 'cache_control' => nil, 'sequence_number' => 0, 'blob_type' => 'BlockBlob', 'copy_id' => '095adc3b-e277-4c3d-97e0-0abca881f60c', 'copy_status' => 'success', 'copy_source' => 'https://testaccount.blob.core.windows.net/test_container/test_blob?snapshot=2016-02-04T08%3A35%3A50.3256874Z', 'copy_progress' => '4194304/4194304', 'copy_completion_time' => 'Thu, 04 Feb 2016 08:35:52 GMT', 'copy_status_description' => nil, 'accept_ranges' => 0 } } end end |
#create_container ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/fog/azurerm/requests/storage/create_container.rb', line 24 def create_container(*) { 'name' => 'test_container', 'public_access_level' => nil, 'metadata' => {}, 'properties' => { 'last_modified' => 'Mon, 04 Jul 2016 02:50:20 GMT', 'etag' => '0x8D3A3B5F017F52D', 'lease_status' => 'unlocked', 'lease_state' => 'available' } } end |
#create_disk ⇒ Object
55 56 57 58 |
# File 'lib/fog/azurerm/requests/storage/create_disk.rb', line 55 def create_disk(*) Fog::Logger.debug 'Disk created successfully.' true end |
#create_page_blob ⇒ Object
24 25 26 27 |
# File 'lib/fog/azurerm/requests/storage/create_page_blob.rb', line 24 def create_page_blob(*) Fog::Logger.debug 'Page blob created successfully.' true end |
#create_storage_account ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/fog/azurerm/requests/storage/create_storage_account.rb', line 50 def create_storage_account(*) storage_account_hash = { 'id' => '/subscriptions/67f2116d-4ea2-4c6c-b20a-f92183dbe3cb/resourceGroups/fog_test_rg/providers/Microsoft.Storage/storageAccounts/fogtestsasecond', 'name' => 'fog-test-storage-account', 'location' => 'west us', 'sku' => { 'name' => 'Standard_LRS' } } storage_account_mapper = Azure::ARM::Storage::Models::StorageAccount.mapper storage_mgmt_client.deserialize(storage_account_mapper, storage_account_hash, 'hash') end |
#delete_blob ⇒ Object
25 26 27 28 |
# File 'lib/fog/azurerm/requests/storage/delete_blob.rb', line 25 def delete_blob(*) Fog::Logger.debug 'Blob deleted successfully.' true end |
#delete_container ⇒ Object
25 26 27 |
# File 'lib/fog/azurerm/requests/storage/delete_container.rb', line 25 def delete_container(*) true end |
#delete_disk ⇒ Object
29 30 31 32 |
# File 'lib/fog/azurerm/requests/storage/delete_disk.rb', line 29 def delete_disk(*) Fog::Logger.debug 'Successfully deleted Disk' true end |
#delete_storage_account(resource_group, name) ⇒ Object
20 21 22 23 |
# File 'lib/fog/azurerm/requests/storage/delete_storage_account.rb', line 20 def delete_storage_account(resource_group, name) Fog::Logger.debug "Storage Account #{name} from Resource group #{resource_group} deleted successfully." true end |
#get_blob(_container_name, _blob_name, _options = {}, &_block) ⇒ Object
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/fog/azurerm/requests/storage/get_blob.rb', line 87 def get_blob(_container_name, _blob_name, = {}, &_block) Fog::Logger.debug 'get_blob successfully.' unless block_given? return [ { 'name' => 'test_blob', 'metadata' => {}, 'properties' => { 'last_modified' => 'Mon, 04 Jul 2016 09:30:31 GMT', 'etag' => '0x8D3A3EDD7C2B777', 'lease_status' => 'unlocked', 'lease_state' => 'available', 'lease_duration' => nil, 'content_length' => 4_194_304, 'content_type' => 'application/octet-stream', 'content_encoding' => nil, 'content_language' => nil, 'content_disposition' => nil, 'content_md5' => 'tXAohIyxuu/t94Lp/ujeRw==', 'cache_control' => nil, 'sequence_number' => 0, 'blob_type' => 'PageBlob', 'copy_id' => '095adc3b-e277-4c3d-97e0-0abca881f60c', 'copy_status' => 'success', 'copy_source' => 'https://testaccount.blob.core.windows.net/testblob/4m?snapshot=2016-02-04T08%3A35%3A50.3157696Z', 'copy_progress' => '4194304/4194304', 'copy_completion_time' => 'Thu, 04 Feb 2016 08:35:52 GMT', 'copy_status_description' => nil, 'accept_ranges' => 0 } }, 'content' ] end data = StringIO.new('content') remaining = total_bytes = data.length while remaining > 0 chunk = data.read([remaining, 2].min) Proc.new.call(chunk, remaining, total_bytes) remaining -= 2 end [ { 'name' => 'test_blob', 'metadata' => {}, 'properties' => { 'last_modified' => 'Mon, 04 Jul 2016 09:30:31 GMT', 'etag' => '0x8D3A3EDD7C2B777', 'lease_status' => 'unlocked', 'lease_state' => 'available', 'lease_duration' => nil, 'content_length' => 4_194_304, 'content_type' => 'application/octet-stream', 'content_encoding' => nil, 'content_language' => nil, 'content_disposition' => nil, 'content_md5' => 'tXAohIyxuu/t94Lp/ujeRw==', 'cache_control' => nil, 'sequence_number' => 0, 'blob_type' => 'PageBlob', 'copy_id' => '095adc3b-e277-4c3d-97e0-0abca881f60c', 'copy_status' => 'success', 'copy_source' => 'https://testaccount.blob.core.windows.net/testblob/4m?snapshot=2016-02-04T08%3A35%3A50.3157696Z', 'copy_progress' => '4194304/4194304', 'copy_completion_time' => 'Thu, 04 Feb 2016 08:35:52 GMT', 'copy_status_description' => nil, 'accept_ranges' => 0 } }, '' ] end |
#get_blob_http_url ⇒ Object
33 34 35 |
# File 'lib/fog/azurerm/requests/storage/get_blob_http_url.rb', line 33 def get_blob_http_url(*) 'http://sa.blob.core.windows.net/test_container/test_blob?token' end |
#get_blob_https_url ⇒ Object
33 34 35 |
# File 'lib/fog/azurerm/requests/storage/get_blob_https_url.rb', line 33 def get_blob_https_url(*) 'https://sa.blob.core.windows.net/test_container/test_blob?token' end |
#get_blob_properties ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/fog/azurerm/requests/storage/get_blob_properties.rb', line 23 def get_blob_properties(*) blob = Azure::Storage::Blob::Blob.new blob.name = 'test_blob' blob. = {} blob.properties = { last_modified: 'Mon, 04 Jul 2016 09:30:31 GMT', etag: '0x8D3A3EDD7C2B777', lease_status: 'unlocked', lease_state: 'available', lease_duration: nil, content_length: 4_194_304, content_type: 'application/octet-stream', content_encoding: nil, content_language: nil, content_disposition: nil, content_md5: 'tXAohIyxuu/t94Lp/ujeRw==', cache_control: nil, sequence_number: 0, blob_type: 'PageBlob', copy_id: '095adc3b-e277-4c3d-97e0-0abca881f60c', copy_status: 'success', copy_source: 'https://testaccount.blob.core.windows.net/testblob/4m?snapshot=2016-02-04T08%3A35%3A50.3157696Z', copy_progress: '4194304/4194304', copy_completion_time: 'Thu, 04 Feb 2016 08:35:52 GMT', copy_status_description: nil, accept_ranges: 0 } blob end |
#get_blob_url(_container_name, _blob_name, options = {}) ⇒ Object
20 21 22 23 24 |
# File 'lib/fog/azurerm/requests/storage/get_blob_url.rb', line 20 def get_blob_url(_container_name, _blob_name, = {}) url = 'https://sa.blob.core.windows.net/test_container/test_blob' url.gsub!('https:', 'http:') if [:scheme] == 'http' url end |
#get_container_acl ⇒ Object
24 25 26 |
# File 'lib/fog/azurerm/requests/storage/get_container_acl.rb', line 24 def get_container_acl(*) ['container', {}] end |
#get_container_properties ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/fog/azurerm/requests/storage/get_container_properties.rb', line 25 def get_container_properties(*) { 'name' => 'test_container', 'public_access_level' => nil, 'metadata' => {}, 'properties' => { 'last_modified' => 'Mon, 04 Jul 2016 02:50:20 GMT', 'etag' => '0x8D3A3B5F017F52D', 'lease_status' => 'unlocked', 'lease_state' => 'available' } } end |
#get_container_url(_container_name, options = {}) ⇒ Object
26 27 28 29 30 |
# File 'lib/fog/azurerm/requests/storage/get_container_url.rb', line 26 def get_container_url(_container_name, = {}) url = 'https://sa.blob.core.windows.net/test_container?comp=list&restype=container' url.gsub!('https:', 'http:') if [:scheme] == 'http' url end |
#get_storage_access_keys(_resource_group, storage_account_name, _options = {}) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/fog/azurerm/requests/storage/get_storage_access_keys.rb', line 21 def get_storage_access_keys(_resource_group, storage_account_name, = {}) Fog::Logger.debug "Getting storage access keys for storage account: #{storage_account_name}." Fog::Logger.debug "Storage access keys for storage account: #{storage_account_name} listed successfully." { 'key1' => 'key1 value', 'key2' => 'key2 value' } end |
#get_storage_account ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/fog/azurerm/requests/storage/get_storage_account.rb', line 20 def get_storage_account(*) storage_account_hash = { 'id' => '/subscriptions/67f2116d-4ea2-4c6c-b20a-f92183dbe3cb/resourceGroups/fog_test_rg/providers/Microsoft.Storage/storageAccounts/fogtestsasecond', 'name' => 'fog-test-storage-account', 'location' => 'west us', 'sku' => { 'name' => 'Standard_LRS' } } storage_account_mapper = Azure::ARM::Storage::Models::StorageAccount.mapper storage_mgmt_client.deserialize(storage_account_mapper, storage_account_hash, 'hash') end |
#list_blobs ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'lib/fog/azurerm/requests/storage/list_blobs.rb', line 53 def list_blobs(*) Fog::Logger.debug 'Listing blobs in container successfully.' { next_marker: 'marker', blobs: [ { 'name' => 'test_blob1', 'metadata' => {}, 'properties' => { 'last_modified' => 'Mon, 04 Jul 2016 02:50:20 GMT', 'etag' => '0x8D3A3B5F017F52D', 'lease_status' => 'unlocked', 'lease_state' => 'available', 'content_length' => 4_194_304, 'content_type' => 'application/octet-stream', 'content_encoding' => nil, 'content_language' => nil, 'content_disposition' => nil, 'content_md5' => 'tXAohIyxuu/t94Lp/ujeRw==', 'cache_control' => nil, 'sequence_number' => 0, 'blob_type' => 'PageBlob', 'copy_id' => '095adc3b-e277-4c3d-97e0-0abca881f60c', 'copy_status' => 'success', 'copy_source' => 'https://testaccount.blob.core.windows.net/test_container/test_blob?snapshot=2016-02-04T08%3A35%3A50.3256874Z', 'copy_progress' => '4194304/4194304', 'copy_completion_time' => 'Thu, 04 Feb 2016 08:35:52 GMT', 'copy_status_description' => nil, 'accept_ranges' => 0 } }, { 'name' => 'test_blob2', 'metadata' => {}, 'properties' => { 'last_modified' => 'Tue, 04 Aug 2015 06:02:08 GMT', 'etag' => '0x8D29C92173526C8', 'lease_status' => 'unlocked', 'lease_state' => 'available', 'content_length' => 4_194_304, 'content_type' => 'application/octet-stream', 'content_encoding' => nil, 'content_language' => nil, 'content_disposition' => nil, 'content_md5' => 'tXAohIyxuu/t94Lp/ujeRw==', 'cache_control' => nil, 'sequence_number' => 0, 'blob_type' => 'PageBlob', 'copy_id' => '0abcdc3b-4c3d-e277-97e0-0abca881f60c', 'copy_status' => 'success', 'copy_source' => 'https://testaccount.blob.core.windows.net/test_container/test_blob?snapshot=2016-02-04T08%3A35%3A55.3157696Z', 'copy_progress' => '4194304/4194304', 'copy_completion_time' => 'Thu, 04 Feb 2016 08:40:52 GMT', 'copy_status_description' => nil, 'accept_ranges' => 0 } }, { 'name' => 'test_blob3', 'metadata' => {}, 'properties' => { 'last_modified' => 'Tue, 04 Aug 2015 06:02:08 GMT', 'etag' => '0x8D29C92173526C8', 'lease_status' => 'unlocked', 'lease_state' => 'available', 'content_length' => 4_194_304, 'content_type' => 'application/octet-stream', 'content_encoding' => nil, 'content_language' => nil, 'content_disposition' => nil, 'content_md5' => 'tXAohIyxuu/t94Lp/ujeRw==', 'cache_control' => nil, 'sequence_number' => 0, 'blob_type' => 'PageBlob', 'copy_id' => '0abcdc3b-4c3d-e277-97e0-0abca881f60c', 'copy_status' => 'success', 'copy_source' => 'https://testaccount.blob.core.windows.net/test_container/test_blob?snapshot=2016-02-04T08%3A35%3A55.3157696Z', 'copy_progress' => '4194304/4194304', 'copy_completion_time' => 'Thu, 04 Feb 2016 08:40:52 GMT', 'copy_status_description' => nil, 'accept_ranges' => 0 } }, { 'name' => 'test_blob4', 'metadata' => {}, 'properties' => { 'last_modified' => 'Tue, 04 Aug 2015 06:02:08 GMT', 'etag' => '0x8D29C92173526C8', 'lease_status' => 'unlocked', 'lease_state' => 'available', 'content_length' => 4_194_304, 'content_type' => 'application/octet-stream', 'content_encoding' => nil, 'content_language' => nil, 'content_disposition' => nil, 'content_md5' => 'tXAohIyxuu/t94Lp/ujeRw==', 'cache_control' => nil, 'sequence_number' => 0, 'blob_type' => 'PageBlob', 'copy_id' => '0abcdc3b-4c3d-e277-97e0-0abca881f60c', 'copy_status' => 'success', 'copy_source' => 'https://testaccount.blob.core.windows.net/test_container/test_blob?snapshot=2016-02-04T08%3A35%3A55.3157696Z', 'copy_progress' => '4194304/4194304', 'copy_completion_time' => 'Thu, 04 Feb 2016 08:40:52 GMT', 'copy_status_description' => nil, 'accept_ranges' => 0 } } ] } end |
#list_containers ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/fog/azurerm/requests/storage/list_containers.rb', line 36 def list_containers [ { 'name' => 'test_container1', 'metadata' => {}, 'properties' => { 'last_modified' => 'Mon, 04 Jul 2016 02:50:20 GMT', 'etag' => '0x8D3A3B5F017F52D', 'lease_status' => 'unlocked', 'lease_state' => 'available' } }, { 'name' => 'test_container2', 'metadata' => {}, 'properties' => { 'last_modified' => 'Tue, 04 Aug 2015 06:01:08 GMT', 'etag' => '0x8D29C92176C8352', 'lease_status' => 'unlocked', 'lease_state' => 'available' } }, { 'name' => 'test_container3', 'metadata' => {}, 'properties' => { 'last_modified' => 'Tue, 01 Sep 2015 05:15:36 GMT', 'etag' => '0x8D2B28C5EB36458', 'lease_status' => 'unlocked', 'lease_state' => 'available' } } ] end |
#list_storage_account_for_rg(resource_group) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/fog/azurerm/requests/storage/list_storage_account_for_rg.rb', line 19 def list_storage_account_for_rg(resource_group) [ { 'id' => "/subscriptions/{subscriptionId}/resourceGroups/#{resource_group}/providers/Microsoft.Storage/storageAccounts/mock_test_storage_account", 'name' => 'mock_test_storage_account', 'type' => 'Microsoft.Storage/storageAccounts', 'location' => 'westus', 'tags' => {}, 'properties' => { 'provisioningState' => 'Succeeded', 'accountType' => 'Standard_LRS', 'primaryEndpoints' => { 'blob' => 'https://mock_test_storage_account.blob.core.windows.net/', 'queue' => 'https://mock_test_storage_account.queue.core.windows.net/', 'table' => 'https://mock_test_storage_account.table.core.windows.net/', 'file' => 'https://mock_test_storage_account.file.core.windows.net/' }, 'primaryLocation' => 'westus', 'statusOfPrimary' => 'available', 'lastGeoFailoverTime' => '2016-05-19T09:58:55Z', 'creationTime' => '2016-05-19T05:24:36Z' } } ] end |
#list_storage_accounts ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/fog/azurerm/requests/storage/list_storage_accounts.rb', line 19 def list_storage_accounts [ { 'id' => '/subscriptions/{subscriptionId}/resourceGroups/mock_test_resource_group/providers/Microsoft.Storage/storageAccounts/mock_test_storage_account', 'name' => 'mock_test_storage_account', 'type' => 'Microsoft.Storage/storageAccounts', 'location' => 'westus', 'tags' => {}, 'properties' => { 'provisioningState' => 'Succeeded', 'accountType' => 'Standard_LRS', 'primaryEndpoints' => { 'blob' => 'https://mock_test_storage_account.blob.core.windows.net/', 'queue' => 'https://mock_test_storage_account.queue.core.windows.net/', 'table' => 'https://mock_test_storage_account.table.core.windows.net/', 'file' => 'https://mock_test_storage_account.file.core.windows.net/' }, 'primaryLocation' => 'westus', 'statusOfPrimary' => 'available', 'lastGeoFailoverTime' => '2016-05-19T09:49:07Z', 'creationTime' => '2016-05-19T05:24:36Z' } } ] end |
#multipart_save_block_blob ⇒ Object
104 105 106 |
# File 'lib/fog/azurerm/requests/storage/multipart_save_block_blob.rb', line 104 def multipart_save_block_blob(*) true end |
#put_blob_block ⇒ Object
24 25 26 |
# File 'lib/fog/azurerm/requests/storage/put_blob_block.rb', line 24 def put_blob_block(*) true end |
#put_blob_metadata(container_name, name, metadata, _options = {}) ⇒ Object
24 25 26 27 |
# File 'lib/fog/azurerm/requests/storage/put_blob_metadata.rb', line 24 def (container_name, name, , = {}) Fog::Logger.debug "Set Blob #{name} metadata #{} in a container #{container_name} successfully." true end |
#put_blob_pages ⇒ Object
24 25 26 |
# File 'lib/fog/azurerm/requests/storage/put_blob_pages.rb', line 24 def put_blob_pages(*) true end |
#put_blob_properties(container_name, name, options = {}) ⇒ Object
24 25 26 27 |
# File 'lib/fog/azurerm/requests/storage/put_blob_properties.rb', line 24 def put_blob_properties(container_name, name, = {}) Fog::Logger.debug "Set Blob #{name} properties #{} in a container #{container_name} successfully." true end |
#put_container_acl ⇒ Object
24 25 26 27 |
# File 'lib/fog/azurerm/requests/storage/put_container_acl.rb', line 24 def put_container_acl(*) Fog::Logger.debug 'Set Container testcontainer1 acl successfully.' true end |
#put_container_metadata ⇒ Object
24 25 26 27 |
# File 'lib/fog/azurerm/requests/storage/put_container_metadata.rb', line 24 def (*) Fog::Logger.debug 'Set Container testcontainer1 metadata successfully.' true end |
#release_blob_lease ⇒ Object
24 25 26 |
# File 'lib/fog/azurerm/requests/storage/release_blob_lease.rb', line 24 def release_blob_lease(*) true end |
#release_container_lease ⇒ Object
24 25 26 |
# File 'lib/fog/azurerm/requests/storage/release_container_lease.rb', line 24 def release_container_lease(*) true end |
#save_page_blob ⇒ Object
105 106 107 |
# File 'lib/fog/azurerm/requests/storage/save_page_blob.rb', line 105 def save_page_blob(*) true end |
#update_storage_account ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/fog/azurerm/requests/storage/update_storage_account.rb', line 43 def update_storage_account(*) storage_account_hash = { 'id' => '/subscriptions/67f2116d-4ea2-4c6c-b20a-f92183dbe3cb/resourceGroups/fog_test_rg/providers/Microsoft.Storage/storageAccounts/fogtestsasecond', 'name' => 'fog-test-storage-account', 'location' => 'west us', 'sku' => { 'name' => 'Standard_LRS' } } storage_account_mapper = Azure::ARM::Storage::Models::StorageAccount.mapper storage_mgmt_client.deserialize(storage_account_mapper, storage_account_hash, 'hash') end |
#wait_blob_copy_operation_to_finish ⇒ Object
50 51 52 |
# File 'lib/fog/azurerm/requests/storage/wait_blob_copy_operation_to_finish.rb', line 50 def wait_blob_copy_operation_to_finish(*) true end |