azure 0.1.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/ChangeLog.txt +5 -0
- data/Gemfile +16 -3
- data/README.md +344 -2
- data/Rakefile +66 -37
- data/azure.gemspec +30 -11
- data/lib/azure.rb +35 -4
- data/lib/azure/blob/blob.rb +32 -0
- data/lib/azure/blob/blob_service.rb +1423 -0
- data/lib/azure/blob/block.rb +31 -0
- data/lib/azure/blob/container.rb +32 -0
- data/lib/azure/blob/serialization.rb +285 -0
- data/lib/azure/core.rb +32 -0
- data/lib/azure/core/auth/authorizer.rb +36 -0
- data/lib/azure/core/auth/shared_key.rb +21 -6
- data/lib/azure/core/auth/shared_key_lite.rb +17 -3
- data/lib/azure/core/auth/signer.rb +48 -0
- data/lib/azure/core/configuration.rb +152 -0
- data/lib/azure/core/error.rb +22 -0
- data/lib/azure/core/filtered_service.rb +44 -0
- data/lib/azure/core/http/debug_filter.rb +36 -0
- data/lib/azure/core/http/http_error.rb +84 -0
- data/lib/azure/core/http/http_filter.rb +53 -0
- data/lib/azure/core/http/http_request.rb +157 -0
- data/lib/azure/core/http/http_response.rb +133 -0
- data/lib/azure/core/http/retry_policy.rb +68 -0
- data/lib/azure/core/http/signer_filter.rb +34 -0
- data/lib/azure/core/service.rb +38 -32
- data/lib/azure/core/signed_service.rb +43 -0
- data/lib/azure/queue/message.rb +30 -0
- data/lib/azure/queue/queue.rb +29 -0
- data/lib/azure/queue/queue_service.rb +568 -0
- data/lib/azure/queue/serialization.rb +103 -0
- data/lib/azure/service/access_policy.rb +26 -0
- data/lib/azure/service/enumeration_results.rb +21 -0
- data/lib/azure/service/logging.rb +32 -0
- data/lib/azure/service/metrics.rb +31 -0
- data/lib/azure/service/retention_policy.rb +25 -0
- data/lib/azure/service/serialization.rb +240 -0
- data/lib/azure/service/signed_identifier.rb +30 -0
- data/lib/azure/service/storage_service.rb +79 -0
- data/lib/azure/service/storage_service_properties.rb +32 -0
- data/lib/azure/service_bus/action.rb +21 -0
- data/lib/azure/service_bus/auth/wrap_service.rb +59 -46
- data/lib/azure/service_bus/auth/wrap_signer.rb +69 -0
- data/lib/azure/service_bus/brokered_message.rb +36 -51
- data/lib/azure/service_bus/brokered_message_serializer.rb +48 -34
- data/lib/azure/service_bus/correlation_filter.rb +45 -0
- data/lib/azure/service_bus/empty_rule_action.rb +30 -0
- data/lib/azure/service_bus/false_filter.rb +38 -0
- data/lib/azure/service_bus/filter.rb +21 -0
- data/lib/azure/{core/utils → service_bus}/interval.rb +29 -22
- data/lib/azure/service_bus/queue.rb +230 -0
- data/lib/azure/service_bus/resource.rb +109 -0
- data/lib/azure/service_bus/rule.rb +98 -0
- data/lib/azure/service_bus/rule_aspect.rb +34 -0
- data/lib/azure/service_bus/serialization.rb +160 -0
- data/lib/azure/service_bus/service_bus_service.rb +819 -12
- data/lib/azure/service_bus/sql_filter.rb +50 -0
- data/lib/azure/service_bus/sql_rule_action.rb +50 -0
- data/lib/azure/service_bus/subscription.rb +184 -0
- data/lib/azure/service_bus/topic.rb +187 -0
- data/lib/azure/service_bus/true_filter.rb +38 -0
- data/lib/azure/{tables → table}/auth/shared_key.rb +33 -12
- data/lib/azure/table/auth/shared_key_lite.rb +44 -0
- data/lib/azure/table/batch.rb +330 -0
- data/lib/azure/table/batch_response.rb +117 -0
- data/lib/azure/table/edmtype.rb +127 -0
- data/lib/azure/table/entity.rb +31 -0
- data/lib/azure/table/guid.rb +24 -0
- data/lib/azure/table/query.rb +112 -0
- data/lib/azure/table/serialization.rb +105 -0
- data/lib/azure/table/table_service.rb +557 -0
- data/lib/azure/version.rb +31 -0
- data/test/fixtures/container_acl.xml +11 -0
- data/test/fixtures/{error.xml → http_error.xml} +0 -0
- data/test/fixtures/list_blobs.xml +121 -0
- data/test/fixtures/list_block_all_with_none_committed.xml +22 -0
- data/test/fixtures/list_blocks_all.xml +23 -0
- data/test/fixtures/list_blocks_committed.xml +13 -0
- data/test/fixtures/list_containers.xml +38 -0
- data/test/fixtures/list_page_ranges.xml +11 -0
- data/test/fixtures/logging.xml +11 -0
- data/test/fixtures/metrics.xml +10 -0
- data/test/fixtures/queues.xml +1 -1
- data/test/fixtures/retention_policy.xml +5 -0
- data/test/fixtures/storage_service_properties.xml +23 -0
- data/test/integration/blob/blob_metadata_test.rb +75 -0
- data/test/integration/blob/blob_pages_test.rb +119 -0
- data/test/integration/blob/blob_properties_test.rb +77 -0
- data/test/integration/blob/block_blob_test.rb +254 -0
- data/test/integration/blob/container/container_acl_test.rb +69 -0
- data/test/integration/blob/container/container_metadata_test.rb +50 -0
- data/test/integration/blob/container/create_container_test.rb +60 -0
- data/test/integration/blob/container/delete_container_test.rb +39 -0
- data/test/integration/blob/container/get_container_properties_test.rb +48 -0
- data/test/integration/blob/container/list_containers_test.rb +79 -0
- data/test/integration/blob/container/root_container_test.rb +50 -0
- data/test/integration/blob/copy_blob_test.rb +113 -0
- data/test/integration/blob/create_blob_snapshot_test.rb +80 -0
- data/test/integration/blob/create_page_blob_test.rb +83 -0
- data/test/integration/blob/delete_blob_test.rb +159 -0
- data/test/integration/blob/get_blob_test.rb +65 -0
- data/test/integration/blob/informative_errors_test.rb +39 -0
- data/test/integration/blob/lease/acquire_lease_test.rb +36 -0
- data/test/integration/blob/lease/break_lease_test.rb +40 -0
- data/test/integration/blob/lease/release_lease_test.rb +40 -0
- data/test/integration/blob/lease/renew_lease_test.rb +42 -0
- data/test/integration/blob/list_blobs_test.rb +113 -0
- data/test/integration/queue/clear_messages_test.rb +42 -0
- data/test/integration/queue/create_message_test.rb +75 -0
- data/test/integration/queue/create_queue_test.rb +50 -0
- data/test/integration/queue/delete_message_test.rb +67 -0
- data/test/integration/queue/delete_queue_test.rb +45 -0
- data/test/integration/queue/informative_errors_test.rb +42 -0
- data/test/integration/queue/list_messages_encoded_test.rb +79 -0
- data/test/integration/queue/list_messages_test.rb +79 -0
- data/test/integration/queue/list_queues_test.rb +44 -0
- data/test/integration/queue/peek_messages_test.rb +59 -0
- data/test/integration/queue/queue_metadata_test.rb +40 -0
- data/test/integration/queue/update_message_test.rb +74 -0
- data/test/integration/service_bus/informative_errors_test.rb +37 -0
- data/test/integration/service_bus/queues_scenario_test.rb +200 -0
- data/test/integration/service_bus/queues_test.rb +266 -0
- data/test/integration/service_bus/rules_test.rb +145 -0
- data/test/integration/service_bus/scenario_test.rb +102 -0
- data/test/integration/service_bus/subscriptions_test.rb +211 -0
- data/test/integration/service_bus/topics_scenario_test.rb +406 -0
- data/test/integration/service_bus/topics_test.rb +129 -0
- data/test/integration/table/create_table_test.rb +36 -0
- data/test/integration/table/delete_entity_batch_test.rb +107 -0
- data/test/integration/table/delete_entity_test.rb +94 -0
- data/test/integration/table/delete_table_test.rb +40 -0
- data/test/integration/table/get_table_test.rb +37 -0
- data/test/integration/table/informative_errors_test.rb +39 -0
- data/test/integration/table/insert_entity_batch_test.rb +100 -0
- data/test/integration/table/insert_entity_test.rb +88 -0
- data/test/integration/table/insert_or_merge_entity_batch_test.rb +159 -0
- data/test/integration/table/insert_or_merge_entity_test.rb +143 -0
- data/test/integration/table/insert_or_replace_entity_batch_test.rb +152 -0
- data/test/integration/table/insert_or_replace_entity_test.rb +137 -0
- data/test/integration/table/merge_entity_batch_test.rb +128 -0
- data/test/integration/table/merge_entity_test.rb +113 -0
- data/test/integration/table/query_entities_test.rb +195 -0
- data/test/integration/table/query_tables_test.rb +43 -0
- data/test/integration/table/query_test.rb +251 -0
- data/test/integration/table/table_acl_test.rb +52 -0
- data/test/integration/table/update_entity_batch_test.rb +149 -0
- data/test/integration/table/update_entity_test.rb +131 -0
- data/test/integration/test_helper.rb +23 -9
- data/test/support/env.rb +15 -1
- data/test/support/fixtures.rb +14 -0
- data/test/support/name_generator.rb +74 -0
- data/test/support/stubs.rb +14 -0
- data/test/test_helper.rb +43 -3
- data/test/unit/blob/blob_service_test.rb +1947 -0
- data/test/unit/core/auth/shared_key_lite_test.rb +51 -0
- data/test/unit/core/auth/shared_key_test.rb +58 -0
- data/test/unit/core/auth/signer_test.rb +30 -0
- data/test/unit/core/http/http_error_test.rb +57 -0
- data/test/unit/core/http/http_request_test.rb +66 -0
- data/test/unit/core/http/http_response_test.rb +45 -0
- data/test/unit/service/serialization_test.rb +502 -0
- data/test/unit/service/storage_service_test.rb +291 -0
- data/test/unit/table/edmtype_test.rb +108 -0
- metadata +231 -230
- data/Gemfile.lock +0 -36
- data/lib/azure/atom.rb +0 -170
- data/lib/azure/auth.rb +0 -29
- data/lib/azure/blobs.rb +0 -620
- data/lib/azure/blobs/blob.rb +0 -360
- data/lib/azure/blobs/container.rb +0 -209
- data/lib/azure/blobs/service.rb +0 -396
- data/lib/azure/blobs/shared_access_signature.rb +0 -84
- data/lib/azure/blobs/uri.rb +0 -60
- data/lib/azure/configuration.rb +0 -121
- data/lib/azure/core/collection.rb +0 -118
- data/lib/azure/core/signer.rb +0 -32
- data/lib/azure/core/utils/queryable.rb +0 -74
- data/lib/azure/core/utils/storage_service_properties.rb +0 -83
- data/lib/azure/core/utils/string.rb +0 -59
- data/lib/azure/error.rb +0 -72
- data/lib/azure/queues.rb +0 -272
- data/lib/azure/queues/message.rb +0 -174
- data/lib/azure/queues/queue.rb +0 -187
- data/lib/azure/queues/service.rb +0 -263
- data/lib/azure/queues/service_properties.rb +0 -152
- data/lib/azure/queues/uri.rb +0 -78
- data/lib/azure/request.rb +0 -102
- data/lib/azure/response.rb +0 -93
- data/lib/azure/service_bus.rb +0 -4
- data/lib/azure/service_bus/auth/authorizer.rb +0 -22
- data/lib/azure/service_bus/auth/uri.rb +0 -52
- data/lib/azure/service_bus/auth/wrap.rb +0 -37
- data/lib/azure/service_bus/auth/wrap_token.rb +0 -45
- data/lib/azure/service_bus/auth/wrap_token_manager.rb +0 -46
- data/lib/azure/service_bus/queues.rb +0 -194
- data/lib/azure/service_bus/queues/queue.rb +0 -100
- data/lib/azure/service_bus/queues/queue_serializer.rb +0 -51
- data/lib/azure/service_bus/queues/service.rb +0 -154
- data/lib/azure/service_bus/queues/uri.rb +0 -80
- data/lib/azure/service_bus/rules.rb +0 -110
- data/lib/azure/service_bus/rules/rule.rb +0 -97
- data/lib/azure/service_bus/rules/service.rb +0 -122
- data/lib/azure/service_bus/rules/uri.rb +0 -39
- data/lib/azure/service_bus/subscriptions.rb +0 -170
- data/lib/azure/service_bus/subscriptions/service.rb +0 -133
- data/lib/azure/service_bus/subscriptions/subscription.rb +0 -164
- data/lib/azure/service_bus/subscriptions/subscription_serializer.rb +0 -74
- data/lib/azure/service_bus/subscriptions/uri.rb +0 -71
- data/lib/azure/service_bus/topics.rb +0 -120
- data/lib/azure/service_bus/topics/service.rb +0 -98
- data/lib/azure/service_bus/topics/topic.rb +0 -122
- data/lib/azure/service_bus/topics/topic_serializer.rb +0 -44
- data/lib/azure/service_bus/topics/uri.rb +0 -58
- data/lib/azure/service_runtime/client/goal_state_pipe_monitor.rb +0 -21
- data/lib/azure/service_runtime/client/goal_state_protocol.rb +0 -18
- data/lib/azure/service_runtime/client/runtime_client.rb +0 -135
- data/lib/azure/service_runtime/deployment.rb +0 -24
- data/lib/azure/service_runtime/local_resource.rb +0 -15
- data/lib/azure/service_runtime/role.rb +0 -17
- data/lib/azure/service_runtime/role_environment.rb +0 -206
- data/lib/azure/service_runtime/role_environment_change.rb +0 -32
- data/lib/azure/service_runtime/role_instance.rb +0 -35
- data/lib/azure/service_runtime/role_instance_endpoint.rb +0 -14
- data/lib/azure/tables.rb +0 -215
- data/lib/azure/tables/auth/shared_key_lite.rb +0 -30
- data/lib/azure/tables/entities_collection.rb +0 -66
- data/lib/azure/tables/entity.rb +0 -127
- data/lib/azure/tables/service.rb +0 -211
- data/lib/azure/tables/table.rb +0 -129
- data/lib/azure/tables/tables_collection.rb +0 -62
- data/lib/azure/tables/types.rb +0 -65
- data/lib/azure/tables/uri.rb +0 -62
- data/test/integration/blobs/auth_test.rb +0 -19
- data/test/integration/blobs/blob_test.rb +0 -61
- data/test/integration/blobs/clear_page_range_test.rb +0 -19
- data/test/integration/blobs/copy_test.rb +0 -33
- data/test/integration/blobs/create_blobs_test.rb +0 -51
- data/test/integration/blobs/create_container_test.rb +0 -13
- data/test/integration/blobs/create_snapshot_test.rb +0 -17
- data/test/integration/blobs/delete_blob_snapshots_test.rb +0 -19
- data/test/integration/blobs/delete_blobs_test.rb +0 -25
- data/test/integration/blobs/delete_container_test.rb +0 -24
- data/test/integration/blobs/delete_snapshot_test.rb +0 -17
- data/test/integration/blobs/get_blob_snapshot_test.rb +0 -18
- data/test/integration/blobs/get_blobs_test.rb +0 -31
- data/test/integration/blobs/get_page_range_test.rb +0 -19
- data/test/integration/blobs/list_blobs_test.rb +0 -39
- data/test/integration/blobs/list_containers_test.rb +0 -28
- data/test/integration/blobs/manage_blob_leases_test.rb +0 -45
- data/test/integration/blobs/manage_blob_metadata_test.rb +0 -51
- data/test/integration/blobs/manage_blob_properties_test.rb +0 -25
- data/test/integration/blobs/manage_blob_service_properties_test.rb +0 -38
- data/test/integration/blobs/manage_container_metadata_test.rb +0 -46
- data/test/integration/blobs/manage_container_permissions_test.rb +0 -17
- data/test/integration/blobs/update_page_range_test.rb +0 -20
- data/test/integration/queues/clear_messages_test.rb +0 -22
- data/test/integration/queues/create_queue_test.rb +0 -13
- data/test/integration/queues/delete_message_test.rb +0 -42
- data/test/integration/queues/delete_queue_test.rb +0 -24
- data/test/integration/queues/get_messages_test.rb +0 -39
- data/test/integration/queues/list_queues_test.rb +0 -43
- data/test/integration/queues/manage_queue_metadata_test.rb +0 -45
- data/test/integration/queues/manage_queue_service_properties_test.rb +0 -27
- data/test/integration/queues/peek_messages_test.rb +0 -55
- data/test/integration/queues/put_message_test.rb +0 -31
- data/test/integration/queues/update_message_test.rb +0 -46
- data/test/integration/service_bus/auth_test.rb +0 -18
- data/test/integration/service_bus/queues/create_queue_test.rb +0 -25
- data/test/integration/service_bus/queues/delete_message_from_queue_test.rb +0 -29
- data/test/integration/service_bus/queues/delete_queue_test.rb +0 -25
- data/test/integration/service_bus/queues/get_queue_test.rb +0 -23
- data/test/integration/service_bus/queues/list_queues_test.rb +0 -39
- data/test/integration/service_bus/queues/peek_message_from_queue_test.rb +0 -34
- data/test/integration/service_bus/queues/read_and_delete_message_from_queue_test.rb +0 -31
- data/test/integration/service_bus/queues/send_message_to_queue_test.rb +0 -22
- data/test/integration/service_bus/queues/unlock_message_from_queue_test.rb +0 -36
- data/test/integration/service_bus/rules/create_rule_test.rb +0 -19
- data/test/integration/service_bus/rules/delete_rule_test.rb +0 -17
- data/test/integration/service_bus/rules/get_rule_test.rb +0 -21
- data/test/integration/service_bus/rules/list_rules_test.rb +0 -24
- data/test/integration/service_bus/rules/rule_test.rb +0 -16
- data/test/integration/service_bus/subscriptions/create_subscription_test.rb +0 -25
- data/test/integration/service_bus/subscriptions/delete_message_from_subscription_test.rb +0 -31
- data/test/integration/service_bus/subscriptions/delete_subscription_test.rb +0 -30
- data/test/integration/service_bus/subscriptions/fetch_subscription_test.rb +0 -28
- data/test/integration/service_bus/subscriptions/list_subscriptions_test.rb +0 -23
- data/test/integration/service_bus/subscriptions/peek_lock_message_from_subscription_test.rb +0 -42
- data/test/integration/service_bus/subscriptions/read_delete_message_from_subscription_test.rb +0 -36
- data/test/integration/service_bus/subscriptions/subscription_test.rb +0 -31
- data/test/integration/service_bus/subscriptions/unlock_message_from_subscription_test.rb +0 -43
- data/test/integration/service_bus/topics/create_topic_test.rb +0 -25
- data/test/integration/service_bus/topics/delete_topic_test.rb +0 -25
- data/test/integration/service_bus/topics/get_topic_test.rb +0 -23
- data/test/integration/service_bus/topics/list_topics_test.rb +0 -39
- data/test/integration/service_bus/topics/send_message_to_topic_test.rb +0 -23
- data/test/integration/tables/auth_test.rb +0 -29
- data/test/integration/tables/creating_tables_test.rb +0 -16
- data/test/integration/tables/delete_entity_test.rb +0 -39
- data/test/integration/tables/deleting_table_test.rb +0 -22
- data/test/integration/tables/insert_entity_test.rb +0 -23
- data/test/integration/tables/merge_entity_test.rb +0 -28
- data/test/integration/tables/query_entities_test.rb +0 -131
- data/test/integration/tables/query_tables_test.rb +0 -63
- data/test/integration/tables/update_entity_test.rb +0 -54
- data/test/support/blobs.rb +0 -12
- data/test/support/table_names.rb +0 -44
- data/test/unit/atom_test.rb +0 -58
- data/test/unit/auth_test.rb +0 -24
- data/test/unit/blobs/blob_test.rb +0 -5
- data/test/unit/blobs/container_test.rb +0 -67
- data/test/unit/blobs/service_test.rb +0 -17
- data/test/unit/blobs/shared_access_signature_test.rb +0 -66
- data/test/unit/blobs_test.rb +0 -156
- data/test/unit/core/service_test.rb +0 -57
- data/test/unit/core/utils/interval_test.rb +0 -70
- data/test/unit/core/utils/queryable_test.rb +0 -69
- data/test/unit/core/utils/storage_service_properties_test.rb +0 -66
- data/test/unit/error_test.rb +0 -39
- data/test/unit/queues/message_test.rb +0 -40
- data/test/unit/queues/queue_test.rb +0 -64
- data/test/unit/queues/service_properties.rb +0 -35
- data/test/unit/request_test.rb +0 -38
- data/test/unit/response_test.rb +0 -43
- data/test/unit/service_bus/auth/authorizer_test.rb +0 -27
- data/test/unit/service_bus/auth/wrap_token_test.rb +0 -28
- data/test/unit/service_bus/queues/queue_test.rb +0 -38
- data/test/unit/service_bus/topics/topic_test.rb +0 -33
- data/test/unit/service_runtime/data/goalstate.xml +0 -9
- data/test/unit/service_runtime/data/roleenvironmentdata.xml +0 -29
- data/test/unit/service_runtime/data/runtime.xml +0 -6
- data/test/unit/service_runtime/role_environment_test.rb +0 -144
- data/test/unit/tables/auth/shared_key_lite_test.rb +0 -39
- data/test/unit/tables/auth/shared_key_test.rb +0 -45
- data/test/unit/tables/entities_collection_test.rb +0 -39
- data/test/unit/tables/entity_test.rb +0 -72
- data/test/unit/tables/table_test.rb +0 -57
- data/test/unit/tables_test.rb +0 -302
- data/test/unit/types_test.rb +0 -67
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 58379e3390000bfc95e09ef03af2bd8d7f87789e
|
4
|
+
data.tar.gz: 06cfc38fdaffc3aad57bd7fe5bd93c1ec881a57e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c1409401b9b1932adc8a2b4c5736807de92d0711fa1ca79376e8a0771d2027d468965b2dd52dbba5d185862d1670a89bb91f27da57b3144b13eab0dd0d3a7692
|
7
|
+
data.tar.gz: db6148b118e844731a13488e584ea6541ea68aae3c4304d10039c4a579ccf660a74a9007f036cb9f6971745f62e1306df18d944a35a1a512f00ebf0e4af287f5
|
data/.gitignore
ADDED
data/ChangeLog.txt
ADDED
data/Gemfile
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
#-------------------------------------------------------------------------
|
2
|
+
# Copyright (c) Microsoft. All rights reserved.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
#--------------------------------------------------------------------------
|
15
|
+
source 'https://rubygems.org'
|
16
|
+
gemspec
|
data/README.md
CHANGED
@@ -1,3 +1,345 @@
|
|
1
|
-
|
1
|
+
# Windows Azure SDK for Ruby
|
2
2
|
|
3
|
-
|
3
|
+
This project provides a Ruby package that makes it easy to access Windows Azure Services like Storage and Service Bus.
|
4
|
+
|
5
|
+
# Library Features
|
6
|
+
|
7
|
+
* Storage
|
8
|
+
* Blobs
|
9
|
+
* create, list, and delete containers, work with container metadata and permissions, list blobs in container
|
10
|
+
* create block and page blobs (from a stream, a file, or a string), work with blob blocks and pages, delete blobs
|
11
|
+
* work with blob properties, metadata, leases, snapshot a blob
|
12
|
+
* Tables
|
13
|
+
* create and delete tables
|
14
|
+
* create, query, insert, update, merge, and delete entities
|
15
|
+
* Queues
|
16
|
+
* create, list, and delete queues, and work with queue metadata
|
17
|
+
* create, get, peek, update, delete messages
|
18
|
+
* Service Bus
|
19
|
+
* Queues
|
20
|
+
* create, list and delete queues
|
21
|
+
* send, receive, unlock and delete messages
|
22
|
+
* Topics
|
23
|
+
* create, list, and delete topics
|
24
|
+
* send, receive, unlock and delete messages
|
25
|
+
* create, list, and delete subscriptions
|
26
|
+
* create, list, and delete rules
|
27
|
+
|
28
|
+
# Supported Ruby Versions
|
29
|
+
|
30
|
+
* Ruby 1.9.3
|
31
|
+
* Ruby 2.0
|
32
|
+
|
33
|
+
**Notice** that Ruby 2.0 x64 on Windows is not supported due to the [lack of nokogiri](https://github.com/sparklemotion/nokogiri/issues/864).
|
34
|
+
|
35
|
+
# Getting Started
|
36
|
+
|
37
|
+
## Install the rubygem package
|
38
|
+
|
39
|
+
You can install the azure rubygem package directly.
|
40
|
+
|
41
|
+
```bash
|
42
|
+
gem install azure
|
43
|
+
```
|
44
|
+
|
45
|
+
## Download Source Code
|
46
|
+
|
47
|
+
To get the source code of the SDK via **git** just type:
|
48
|
+
|
49
|
+
```bash
|
50
|
+
git clone https://github.com/WindowsAzure/azure-sdk-for-ruby.git
|
51
|
+
cd ./azure-sdk-for-ruby
|
52
|
+
```
|
53
|
+
Then, run bundler to install all the gem dependencies:
|
54
|
+
|
55
|
+
```bash
|
56
|
+
bundle install
|
57
|
+
```
|
58
|
+
|
59
|
+
## Generate Documentation
|
60
|
+
|
61
|
+
Running the this command ``rdoc`` will generate the API documentation in the `./doc` directory.
|
62
|
+
|
63
|
+
## Setup Connection
|
64
|
+
|
65
|
+
You can use this SDK against the Windows Azure Services in the cloud, or against the local Storage Emulator if you are on Windows. Service Bus emulator is not supported. Of course, to use the Windows Azure Services in the cloud, you need to first [create a Windows Azure account](http://www.windowsazure.com/en-us/pricing/free-trial/). After that, you can get the information you need to configure Storage and Service Bus from the [Windows Azure Portal](https://manage.windowsazure.com).
|
66
|
+
|
67
|
+
There are two ways you can set up the connections:
|
68
|
+
|
69
|
+
1. [via code](#via-code)
|
70
|
+
2. [via environment variables](#via-environment-variables)
|
71
|
+
|
72
|
+
### Via Code
|
73
|
+
|
74
|
+
* Against Windows Azure Services in the cloud
|
75
|
+
|
76
|
+
```ruby
|
77
|
+
require "azure"
|
78
|
+
|
79
|
+
Azure.configure do |config|
|
80
|
+
# Configure these 2 properties to use Storage
|
81
|
+
config.storage_account_name = "<your azure storage account name>"
|
82
|
+
config.storage_access_key = "<your azure storage access key>"
|
83
|
+
# Configure these 3 properties to use Service Bus
|
84
|
+
config.sb_namespace = "<your azure service bus namespace>"
|
85
|
+
config.sb_access_key = "<your azure service bus access key>"
|
86
|
+
config.sb_issuer = "<your azure service bus issuer>"
|
87
|
+
end
|
88
|
+
```
|
89
|
+
|
90
|
+
* Against local Emulator (Windows Only)
|
91
|
+
|
92
|
+
```ruby
|
93
|
+
require "azure"
|
94
|
+
|
95
|
+
Azure.configure do |config|
|
96
|
+
# Configure these 2 properties to use local Storage Emulator
|
97
|
+
config.storage_account_name = "devstoreaccount1"
|
98
|
+
config.storage_access_key = "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="
|
99
|
+
config.storage_blob_host = "http://127.0.0.1:10000/devstoreaccount1"
|
100
|
+
config.storage_queue_host = "http://127.0.0.1:10001/devstoreaccount1"
|
101
|
+
config.storage_table_host = "http://127.0.0.1:10002/devstoreaccount1"
|
102
|
+
# Local Service Bus Emulator is not supported
|
103
|
+
end
|
104
|
+
```
|
105
|
+
|
106
|
+
### Via Environment Variables
|
107
|
+
|
108
|
+
* Against Windows Azure Services in the cloud
|
109
|
+
|
110
|
+
* Storage
|
111
|
+
|
112
|
+
```bash
|
113
|
+
AZURE_STORAGE_ACCOUNT = <your azure storage account name>
|
114
|
+
AZURE_STORAGE_ACCESS_KEY = <your azure storage access key>
|
115
|
+
```
|
116
|
+
|
117
|
+
* Service Bus
|
118
|
+
|
119
|
+
```bash
|
120
|
+
AZURE_SERVICEBUS_NAMESPACE = <your azure service bus namespace>
|
121
|
+
AZURE_SERVICEBUS_ACCESS_KEY = <your azure service bus access key>
|
122
|
+
AZURE_SERVICEBUS_ISSUER = <your azure service bus issuer>
|
123
|
+
```
|
124
|
+
|
125
|
+
* Against local Emulator (Windows Only)
|
126
|
+
|
127
|
+
* Storage
|
128
|
+
|
129
|
+
```bash
|
130
|
+
AZURE_STORAGE_ACCOUNT = devstoreaccount1
|
131
|
+
AZURE_STORAGE_ACCESS_KEY = Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==
|
132
|
+
AZURE_STORAGE_BLOB_HOST = http://127.0.0.1:10000/devstoreaccount1
|
133
|
+
AZURE_STORAGE_QUEUE_HOST = http://127.0.0.1:10001/devstoreaccount1
|
134
|
+
AZURE_STORAGE_TABLE_HOST = http://127.0.0.1:10002/devstoreaccount1
|
135
|
+
```
|
136
|
+
|
137
|
+
* Service Bus: not supported
|
138
|
+
|
139
|
+
## Run Test
|
140
|
+
|
141
|
+
You can use the following commands to run:
|
142
|
+
* all the tests: ``rake test``
|
143
|
+
* a specific suite of tests: ``rake test:integration:blob``
|
144
|
+
* one particular test file: ``ruby -I"lib:test" "<path of the test file>"``
|
145
|
+
|
146
|
+
# Usage
|
147
|
+
|
148
|
+
**For more examples, please see the [Windows Azure Ruby Developer Center](http://www.windowsazure.com/en-us/develop/ruby)**
|
149
|
+
|
150
|
+
## Storage
|
151
|
+
|
152
|
+
### Blobs
|
153
|
+
|
154
|
+
```ruby
|
155
|
+
# Require the azure rubygem
|
156
|
+
require "azure"
|
157
|
+
|
158
|
+
# Create an azure storage blob service object
|
159
|
+
azure_blob_service = Azure::BlobService.new
|
160
|
+
|
161
|
+
# Create a container
|
162
|
+
container = azure_blob_service.create_container("test-container")
|
163
|
+
|
164
|
+
# Upload a Blob
|
165
|
+
content = File.open('test.jpg', 'rb') { |file| file.read }
|
166
|
+
azure_blob_service.create_block_blob(container.name, "image-blob", content)
|
167
|
+
|
168
|
+
# List containers
|
169
|
+
azure_blob_service.list_containers()
|
170
|
+
|
171
|
+
# List Blobs
|
172
|
+
azure_blob_service.list_blobs(container.name)
|
173
|
+
|
174
|
+
# Download a Blob
|
175
|
+
blob, content = azure_blob_service.get_blob(container.name, "image-blob")
|
176
|
+
File.open("download.png", "wb") {|f| f.write(content)}
|
177
|
+
|
178
|
+
# Delete a Blob
|
179
|
+
azure_blob_service.delete_blob(container.name, "image-blob")
|
180
|
+
```
|
181
|
+
|
182
|
+
### Tables
|
183
|
+
|
184
|
+
```ruby
|
185
|
+
# Require the azure rubygem
|
186
|
+
require "azure"
|
187
|
+
|
188
|
+
# Create an azure storage table service object
|
189
|
+
azure_table_service = Azure::TableService.new
|
190
|
+
|
191
|
+
# Create a table
|
192
|
+
azure_table_service.create_table("testtable")
|
193
|
+
|
194
|
+
# Insert an entity
|
195
|
+
entity = { "content" => "test entity", :partition_key => "test-partition-key", :row_key => "1" }
|
196
|
+
azure_table_service.insert_entity("testtable", entity)
|
197
|
+
|
198
|
+
# Get an entity
|
199
|
+
result = azure_table_service.get_entity("testtable", "test-partition-key", "1")
|
200
|
+
|
201
|
+
# Update an entity
|
202
|
+
result.properties["content"] = "test entity with updated content"
|
203
|
+
azure_table_service.update_entity(result.table, result.properties)
|
204
|
+
|
205
|
+
# Query entities
|
206
|
+
query = { :filter => "content eq 'test entity'" }
|
207
|
+
result, token = azure_table_service.query_entities("testtable", query)
|
208
|
+
|
209
|
+
# Delete an entity
|
210
|
+
azure_table_service.delete_entity("testtable", "test-partition-key", "1")
|
211
|
+
|
212
|
+
# delete a table
|
213
|
+
azure_table_service.delete_table("testtable")
|
214
|
+
```
|
215
|
+
|
216
|
+
### Queues
|
217
|
+
|
218
|
+
```ruby
|
219
|
+
# Require the azure rubygem
|
220
|
+
require "azure"
|
221
|
+
|
222
|
+
# Create an azure storage queue service object
|
223
|
+
azure_queue_service = Azure::QueueService.new
|
224
|
+
|
225
|
+
# Create a queue
|
226
|
+
azure_queue_service.create_queue("test-queue")
|
227
|
+
|
228
|
+
# Create a message
|
229
|
+
azure_queue_service.create_message("test-queue", "test message")
|
230
|
+
|
231
|
+
# Get one or more messages with setting the visibility timeout
|
232
|
+
result = azure_queue_service.list_messages("test-queue", 30, {:number_of_messages => 10})
|
233
|
+
|
234
|
+
# Get one or more messages without setting the visibility timeout
|
235
|
+
result = azure_queue_service.peek_messages("test-queue", {:number_of_messages => 10})
|
236
|
+
|
237
|
+
# Update a message
|
238
|
+
message = azure_queue_service.list_messages("test-queue", 30)
|
239
|
+
pop_receipt, time_next_visible = azure_queue_service.update_message("test-queue", message.id, message.pop_receipt, "updated test message", 30)
|
240
|
+
|
241
|
+
# Delete a message
|
242
|
+
message = azure_queue_service.list_messages("test-queue", 30)
|
243
|
+
azure_queue_service.delete_message("test-queue", message.id, message.pop_receipt)
|
244
|
+
|
245
|
+
# Delete a queue
|
246
|
+
azure_queue_service.delete_queue("test-queue")
|
247
|
+
```
|
248
|
+
|
249
|
+
## Service Bus
|
250
|
+
|
251
|
+
### Queues
|
252
|
+
|
253
|
+
```ruby
|
254
|
+
# Require the azure rubygem
|
255
|
+
require "azure"
|
256
|
+
|
257
|
+
# Create an azure service bus object
|
258
|
+
azure_service_bus = Azure::ServiceBus::ServiceBus.new
|
259
|
+
|
260
|
+
# Create a queue with just the queue name
|
261
|
+
queue1 = azure_service_bus.create_queue("test-queue-1")
|
262
|
+
|
263
|
+
# Create a queue with a queue object
|
264
|
+
queue2 = Azure::ServiceBus::Queue.new("test-queue-2")
|
265
|
+
queue2.max_size_in_megabytes = 2048
|
266
|
+
queue2 = azure_service_bus.create_queue(queue2)
|
267
|
+
|
268
|
+
# Send a queue message with just the message body
|
269
|
+
azure_service_bus.send_queue_message("test-queue-1", "test queue message")
|
270
|
+
|
271
|
+
# Send a queue message with a brokered message object
|
272
|
+
message = Azure::ServiceBus::BrokeredMessage.new("another test queue message")
|
273
|
+
message.correlation_id = "test-correlation-id-1"
|
274
|
+
azure_service_bus.send_queue_message("test-queue-1", message)
|
275
|
+
|
276
|
+
# Receive a queue message
|
277
|
+
message = azure_service_bus.receive_queue_message("test-queue-1")
|
278
|
+
|
279
|
+
# Delete a queue message
|
280
|
+
azure_service_bus.delete_queue_message(message)
|
281
|
+
|
282
|
+
# Delete a queue
|
283
|
+
azure_service_bus.delete_queue("test-queue-1")
|
284
|
+
```
|
285
|
+
|
286
|
+
### Topics
|
287
|
+
|
288
|
+
```ruby
|
289
|
+
# Require the azure rubygem
|
290
|
+
require "azure"
|
291
|
+
|
292
|
+
# Create an azure service bus object
|
293
|
+
azure_service_bus = Azure::ServiceBus::ServiceBus.new
|
294
|
+
|
295
|
+
# Create a topic with just the topic name
|
296
|
+
topic1 = azure_service_bus.create_topic("test-topic-1")
|
297
|
+
|
298
|
+
# Create a topic with a topic object
|
299
|
+
topic2 = Azure::ServiceBus::Topic.new("test-topic-2")
|
300
|
+
topic2.max_size_in_megabytes = 2048
|
301
|
+
topic2 = azure_service_bus.create_topic(topic2)
|
302
|
+
|
303
|
+
# Create a subscription
|
304
|
+
subscription = Azure::ServiceBus::Subscription.new("test-subscription-1")
|
305
|
+
subscription.topic = topic1.name
|
306
|
+
subscription = azure_service_bus.create_subscription(subscription)
|
307
|
+
|
308
|
+
# Send a topic message with just the message body
|
309
|
+
azure_service_bus.send_topic_message(topic1, "test topic message")
|
310
|
+
|
311
|
+
# Send a topic message with a brokered message object
|
312
|
+
message = Azure::ServiceBus::BrokeredMessage.new("another test topic message")
|
313
|
+
message.correlation_id = "test-correlation-id-1"
|
314
|
+
azure_service_bus.send_topic_message(topic1, message)
|
315
|
+
|
316
|
+
# Receive a subscription message
|
317
|
+
message = azure_service_bus.receive_subscription_message(topic1.name, subscription.name)
|
318
|
+
|
319
|
+
# Delete a subscription message
|
320
|
+
azure_service_bus.delete_subscription_message(message)
|
321
|
+
|
322
|
+
# Delete a subscription
|
323
|
+
azure_service_bus.delete_subscription(subscription)
|
324
|
+
|
325
|
+
# Delete a topic
|
326
|
+
azure_service_bus.delete_topic(topic1)
|
327
|
+
```
|
328
|
+
|
329
|
+
# Need Help?
|
330
|
+
|
331
|
+
Be sure to check out the Windows Azure [Developer Forums on Stack Overflow and MSDN](http://go.microsoft.com/fwlink/?LinkId=234489) if you have trouble with the provided code.
|
332
|
+
|
333
|
+
# Contribute Code or Provide Feedback
|
334
|
+
|
335
|
+
If you would like to become an active contributor to this project please follow the instructions provided in [Windows Azure Projects Contribution Guidelines](http://windowsazure.github.com/guidelines.html).
|
336
|
+
|
337
|
+
If you encounter any bugs with the library please file an issue in the [Issues](https://github.com/WindowsAzure/azure-sdk-for-ruby/issues) section of the project.
|
338
|
+
|
339
|
+
# Learn More
|
340
|
+
|
341
|
+
For documentation on how to host Ruby applications on Windows Azure, please see the [Windows Azure Ruby Developer Center](http://www.windowsazure.com/en-us/develop/ruby/).
|
342
|
+
|
343
|
+
For documentation on Azure PowerShell CLI tool for Windows, please see our readme [here](http://github.com/windowsazure/azure-sdk-tools).
|
344
|
+
|
345
|
+
For documentation on the Azure cross platform CLI tool for Windows, Mac and Linux, please see our readme [here](http://github.com/windowsazure/azure-sdk-tools-xplat).
|
data/Rakefile
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
#-------------------------------------------------------------------------
|
2
|
+
# Copyright (c) Microsoft. All rights reserved.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
#--------------------------------------------------------------------------
|
1
15
|
require "rake/testtask"
|
2
16
|
require "rubygems/package_task"
|
3
17
|
|
@@ -8,11 +22,45 @@ Gem::PackageTask.new(gem_spec) do |pkg|
|
|
8
22
|
end
|
9
23
|
|
10
24
|
namespace :test do
|
25
|
+
task :require_environment do
|
26
|
+
unset_environment = [
|
27
|
+
ENV.fetch("AZURE_STORAGE_ACCOUNT", nil),
|
28
|
+
ENV.fetch("AZURE_STORAGE_ACCESS_KEY", nil),
|
29
|
+
# ENV.fetch("AZURE_TABLE_HOST", nil),
|
30
|
+
# ENV.fetch("AZURE_BLOB_HOST", nil),
|
31
|
+
# ENV.fetch("AZURE_QUEUE_HOST", nil),
|
32
|
+
ENV.fetch("AZURE_SERVICEBUS_NAMESPACE", nil),
|
33
|
+
ENV.fetch("AZURE_SERVICEBUS_ACCESS_KEY", nil),
|
34
|
+
# ENV.fetch("AZURE_SERVICEBUS_ISSUER", nil)
|
35
|
+
].include?(nil)
|
36
|
+
|
37
|
+
abort "[ABORTING] Configure your environment to run the integration tests" if unset_environment
|
38
|
+
end
|
39
|
+
|
11
40
|
Rake::TestTask.new :unit do |t|
|
12
41
|
t.pattern = "test/unit/**/*_test.rb"
|
13
42
|
t.verbose = true
|
14
43
|
t.libs = ["lib", "test"]
|
15
44
|
end
|
45
|
+
|
46
|
+
namespace :unit do
|
47
|
+
def component_task(component)
|
48
|
+
Rake::TestTask.new component do |t|
|
49
|
+
t.pattern = "test/unit/#{component}/**/*_test.rb"
|
50
|
+
t.verbose = true
|
51
|
+
t.libs = ["lib", "test"]
|
52
|
+
end
|
53
|
+
|
54
|
+
task component => "test:require_environment"
|
55
|
+
end
|
56
|
+
|
57
|
+
component_task :core
|
58
|
+
component_task :blob
|
59
|
+
component_task :queue
|
60
|
+
component_task :service
|
61
|
+
component_task :table
|
62
|
+
component_task :service_bus
|
63
|
+
end
|
16
64
|
|
17
65
|
Rake::TestTask.new :integration do |t|
|
18
66
|
t.pattern = "test/integration/**/*_test.rb"
|
@@ -20,6 +68,8 @@ namespace :test do
|
|
20
68
|
t.libs = ["lib", "test"]
|
21
69
|
end
|
22
70
|
|
71
|
+
task :integration => :require_environment
|
72
|
+
|
23
73
|
namespace :integration do
|
24
74
|
def component_task(component)
|
25
75
|
Rake::TestTask.new component do |t|
|
@@ -27,55 +77,34 @@ namespace :test do
|
|
27
77
|
t.verbose = true
|
28
78
|
t.libs = ["lib", "test"]
|
29
79
|
end
|
80
|
+
|
81
|
+
task component => "test:require_environment"
|
30
82
|
end
|
31
83
|
|
32
|
-
component_task :tables
|
33
|
-
component_task :blobs
|
34
|
-
component_task :queues
|
35
84
|
component_task :service_bus
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
key = ENV.fetch("AZURE_ACCESS_KEY", nil)
|
40
|
-
t_host = ENV.fetch("AZURE_TABLE_HOST", nil)
|
41
|
-
b_host = ENV.fetch("AZURE_BLOB_HOST", nil)
|
42
|
-
q_host = ENV.fetch("AZURE_QUEUE_HOST", nil)
|
43
|
-
acs_namespace = ENV.fetch("AZURE_ACS_NAMESPACE", nil)
|
44
|
-
sb_access_key = ENV.fetch("AZURE_SB_ACCESS_KEY", nil)
|
45
|
-
sb_issuer = ENV.fetch("AZURE_SB_ISSUER", nil)
|
46
|
-
|
47
|
-
if name && key && t_host && b_host && q_host && acs_namespace && sb_access_key && sb_issuer
|
48
|
-
Rake::Task["test:integration"].invoke
|
49
|
-
else
|
50
|
-
warn "[WARNING] Configure your environment to run the integration tests"
|
51
|
-
end
|
52
|
-
end
|
85
|
+
component_task :blob
|
86
|
+
component_task :queue
|
87
|
+
component_task :table
|
53
88
|
end
|
54
89
|
|
55
|
-
|
90
|
+
task :cleanup => :require_environment do
|
56
91
|
$:.unshift "lib"
|
57
92
|
require 'azure'
|
58
93
|
|
59
94
|
Azure.configure do |config|
|
60
|
-
config.access_key = ENV.fetch("
|
61
|
-
config.account_name = ENV.fetch("
|
62
|
-
config.table_host = ENV.fetch("AZURE_TABLE_HOST")
|
63
|
-
config.blob_host = ENV.fetch("AZURE_BLOB_HOST")
|
64
|
-
config.queue_host = ENV.fetch("AZURE_QUEUE_HOST")
|
95
|
+
config.access_key = ENV.fetch("AZURE_STORAGE_ACCESS_KEY")
|
96
|
+
config.account_name = ENV.fetch("AZURE_STORAGE_ACCOUNT")
|
97
|
+
# config.table_host = ENV.fetch("AZURE_TABLE_HOST")
|
98
|
+
# config.blob_host = ENV.fetch("AZURE_BLOB_HOST")
|
99
|
+
# config.queue_host = ENV.fetch("AZURE_QUEUE_HOST")
|
65
100
|
|
66
|
-
config.acs_namespace = ENV.fetch("
|
67
|
-
config.sb_access_key = ENV.fetch("
|
68
|
-
config.sb_issuer = ENV.fetch("
|
101
|
+
config.acs_namespace = ENV.fetch("AZURE_SERVICEBUS_NAMESPACE")
|
102
|
+
config.sb_access_key = ENV.fetch("AZURE_SERVICEBUS_ACCESS_KEY")
|
103
|
+
# config.sb_issuer = ENV.fetch("AZURE_SERVICEBUS_ISSUER")
|
69
104
|
end
|
70
|
-
|
71
|
-
Azure::Tables.all.map(&:delete)
|
72
|
-
Azure::Blobs.containers.map(&:delete)
|
73
|
-
Azure::Queues.all.map(&:delete)
|
74
|
-
Azure::ServiceBus::Queues.list.map(&:delete)
|
75
|
-
Azure::ServiceBus::Topics.list.map(&:delete)
|
76
105
|
end
|
77
106
|
end
|
78
107
|
|
79
|
-
task :test => ["test:unit", "test:integration
|
108
|
+
task :test => ["test:unit", "test:integration"]
|
80
109
|
|
81
|
-
task default
|
110
|
+
task :default => :test
|